# Intersection of a facet and a plane

Let's say there is a 3D printer loading a facet with 3 vertexes and a normal:

$$F: \begin{cases} \text{vertexes:}~~ (x_1,y_1,z_1),(x_2,y_2,z_2),(x_3,y_3,z_3) \\ \text{normal:}~~ (n_x,n_y,n_z) \end{cases}$$

When printing the facet at $z_h$ ($z$ of the printer header), the header should follow a line in the plane of

$$S: \begin{cases} z=z_h \end{cases}$$

The result is a line segment starting from point $A$ to $B$.

$$S ~\cap~F=\text{line_segment}(A,B)$$

I am looking for a method which obtains $A$ and $B$ explicitly.

Sort the vertices by $z$-coordinate. Some simple range checks will then tell you which edges intersect the plane for a given $z$-value, and the intersection points can be found by linear interpolation.
• Looking for $A=..., B=...$ answer. – ar2015 Jan 19 '18 at 3:21