Obtain 3D shape cross section
5 views (last 30 days)
Show older comments
i have designed a part in CAD based software as shown in the image, this shape is extruded on the Z axis. I am looking for a way to import this geometry into MATLAB and select a specific Z offset from which i can obtain the points that make up the cross section at the Z offset. Additionally I would like to seperate the points into an outer and inner groups and order the points in a way that if plotted they connect to draw the accurate cross section with no intersections.
I have tried importing the shape as an stl file and then i obtain the points at the desired Z offset by getting the intersetcions of the triangles generated from the mesh at the Z offset, however the points obtained are not in order and adapting the nearest point algorithm isnt sufficient to correct the order for any random geometry.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1453332/image.png)
1 Comment
Daniel Bengtson
on 8 Aug 2023
If this example is representative of the shapes that you are working with, could you convert the points that you have into polar coordinates then just sort by theta? Thresholding between the outer and inner boundary could probably be done by clustering rho.
Answers (1)
Shubham
on 6 Sep 2023
Building on the idea suggested by @Daniel Bengtson in the comments, You can separate the inner and outer points by various ways:
- Clustering the points
- Using any known feature or shape that your CAD model provides to get the threshold value to categorize between inner and outer points.
- You can visually inspect the cross-section and adjust the threshold until it separates the points correctly.
- Calculate the distance between each point and the centroid of the cross-section. Set the threshold based on the mean distance from the centroid of cross section (average of points) to all other intersection points.
After separating the points into inner points and outer points, You can order them based on their angle. Take one point and centroid as a reference and calculate angles of other points and sort them.
Hope this helps!!
0 Comments
See Also
Categories
Find more on Model Import in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!