Find a plane that is tangent to a part of the 3D model
2 views (last 30 days)
Show older comments
Hello!
I have got a 3D model and I want to find a 2D plane that is tangent to the bottom of my 3D model. The bottom is made up of three sphere-like structures spliced together. I want to know how to find such a plane to make it tangent to the bottom? There should be three tangent points.
The following figure attaches my 3D model and schematic diagram
3 Comments
Accepted Answer
Matt J
on 16 Nov 2021
Edited: Matt J
on 18 Nov 2021
Obtain all the mesh vertices from your stl file in V. Then, compute the facet areas and normals of the convex hull with,
k=convhull(V);
dVa=V(k(:,2),:)-V(k(:,1),:);
dVb=V(k(:,3),:)-V(k(:,1),:);
C=cross(dVa,dVb);
Areas=vecnorm(C,2,2); %facet areas
Normals=normalize(C,2,'norm'); %facet normals
From your diagram, your three spheres look to be within about 10 degrees of the direction vector d=[2 0 1]/sqrt(3), so,
d=[2 0 1]'/sqrt(3);
subset=find(acosd(abs(Normals*d))<30);
[~,i]=max(Areas(subset));
kp=k(subset(i),:);
Vp=V(kp,:); %The 3 annulus vertices
More Answers (0)
See Also
Categories
Find more on Calendar 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!