Obtain 3D shape cross section
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
Daniel Bengtson
2023-8-8
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.
回答(1 个)
Shubham
2023-9-6
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Import 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!