I have a workspace containing a polyhedral shape so I sliced the workspace into different 3D circles. For each circle, it is either there occurs an intersection with the polyhedral or not. Is it possible to determine if the circle intersects with the polyhedron in MATLAB and if yes, how can I determine the polygon formed by the intersection of a 3d circle with a polyhedral shape?
Please I will be glad if the computational geometry is also added but more emphsasis on the MATLAB programming.
NB: 3D circle is a circular shaped object in the 3D space. For ease of understanding, I have attached a MATLAB plot
There are 3 circles and four polyhedral shapes in the plot. Any help will be appreciated
I assume that all polyhedra are convex.
For a given circle and a given polyhedron:
you have first to convert the representation of your polyhedra into a face representation (in Matlab, use convex hull operator "convhull" for that).
then, for each triangular face, you have to test whether or not this face meets the plane of the circle (see appendix below):
-if no, proceed to the next face.
-if yes, test if the intersection points $P_k$ are inside the circle or not (by testing the distance to the circles' center.)
Once you have processed all faces in this way, take the convex hull of all points $P_k$s inside the plane of your circle.
Appendix: How is it possible to know if a triangular face $A_1A_2A_3$ with vertices $A_i(x_i,y_i,z_i)$ intersects the plane with equation $f(x,y,z):=ux+vy+wz+h=0$ ? It is the same as testing if line segments $A_1A_2$ or $A_1A_3$ or $A_2A_2$ intersects it, knowing that $A_iA_j$ intersects the plane if and only if:
$$f(x_i,y_i,z_i)*f(x_j,y_j,z_j)<0$$
a classical criterion that you have surely met if you have had lectures in Computational Geometry.