Programmatically finding faces, edges, etc for an imported geometry
조회 수: 10 (최근 30일)
이전 댓글 표시
채택된 답변
Jack
2025년 3월 9일
Hey Jasdeep,
Yes, you can programmatically find faces, edges, and vertices of an imported geometry in the PDE Toolbox using the findFaces and findEdges functions along with geometric queries.
Finding Faces Based on Location
If your geometry is stored in model.Geometry, you can use findFaces to locate faces that contain a specific point:
model = createpde();
importGeometry(model, 'your_geometry.stl'); % Import your file
% Example: Find face containing a point (x, y, z)
queryPoint = [1, 2, 3]; % Modify as needed
faceID = findFaces(model.Geometry, 'Point', queryPoint);
disp(['Face ID at location: ', num2str(faceID)]);
Finding Edges Based on Location
To get edges near a specific location, use findEdges:
edgeID = findEdges(model.Geometry, 'NearestPoint', queryPoint);
disp(['Edge ID near location: ', num2str(edgeID)]);
Finding Face IDs Without Visual Inspection
If you need to check all faces and their approximate locations:
numFaces = model.Geometry.NumFaces;
for i = 1:numFaces
disp(['Face ', num2str(i), ' centroid: ', num2str(centroid(model.Geometry, i))]);
end
This should let you programmatically identify faces and edges without manually checking the plot.
Follow me so you can message me anytime with future MATLAB questions. If this helps, please accept the answer as well.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!