I want to calculate the two points of a 3D triangle that have a specified Z coordinate. I guess the way to do this would be to somehow create a plane which is perfectly flat with my given Z coordinate and then calculate where the triangle intersects with it (or is this wrong).

If you know how to do this in any way please help. I have searched for but have not really found anything that seems to work.

  • \$\begingroup\$ I don't think you have enough information to find the 3rd point. I believe you'll also need (at least one of) the angles of the corners adjacent to the missing point. \$\endgroup\$
    – House
    Sep 19, 2013 at 3:54
  • \$\begingroup\$ I think I have enough info, I have the 3 Vector3 points of a triangle and I just want to calculate a linesegment of where this triangle intersects with a "plane" (As in a flat surface with a given Z coordinate). This surface could also possibly be defined as a rectangle... \$\endgroup\$
    – Gerharddc
    Sep 19, 2013 at 4:00
  • \$\begingroup\$ I see, I read the question as you had two points and were trying to find the third based off a plane. My mistake. \$\endgroup\$
    – House
    Sep 19, 2013 at 4:16

2 Answers 2


Here is a method that I hope is intuitive enough, assuming z0 is the Z value of your intersection plane:

  • start with an empty list of points L
  • if (A.z - z0) * (B.z - z0) <= 0, it means AB intersects the plane:
    • compute u = (B.z - z0) / (B.z - A.z)
    • add point B + u * (A - B) to list L
  • if (A.z - z0) * (C.z - z0) <= 0:
    • compute u = (C.z - z0) / (C.z - A.z), add point C + u * (A - C) to list L
  • if (B.z - z0) * (C.z - z0) <= 0:
    • compute u = (C.z - z0) / (C.z - B.z), add point C + u * (B - C) to list L

At the end, if L contains two points, that's your segment; otherwise, either the triangle does not intersect or it's a degenerate case. Make sure you check for possible divisions by zero.

  • \$\begingroup\$ This seems interesting, but I am not sure about the variables, I guess A B and C are the points of the triangle, but how can I multiply a value with them and where does the target z coordinate fit into all of this? \$\endgroup\$
    – Gerharddc
    Sep 20, 2013 at 10:10
  • \$\begingroup\$ @Gerhman Yes, A B and C are the triangle points; multiplying a point with a value k consists in multiplying each of its x y and z components with k. Depending on the framework you use, there might already be a function or operator which does it for you. I assumed you wanted the intersection with the z = 0 plane but I’ll update my answer so it works with an arbitrary z0 value. \$\endgroup\$ Sep 20, 2013 at 20:14

You could just du a ray / plane intersection with two rays, after deciding how the triangle intersects with the plane (To intersect at all 1 point has to be on side A and two points on side B of the plane)

This is my standard 'way-over-the-top' ressource for intersections you can look at different implementations and pick the one best suiting your need.

I little less complex is this side, explaining what to do and providing a trianlge-ray algorithm in c (and a lot more under 'algorithms')


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .