Get points of a 3d triangle relative to its own plane in 2d

This topic is 2389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I need to convert a 3d triangle into a 2d triangle, as if it had been rotated so that all points lied on the same z and then ortho projected.

How can I do this?

(Code examples would be very helpful)

Share on other sites
Matrix planeMatrix = makeLookAtMatrix( triangleCenter /*eyePos*/, triangleCenter + triNormal /*aim point*/, pickASensibleUpVector /*make sure it isn't parallel to the aim direction*/ ); planeMatrix = invert(planeMatrix);

now transform the triangle with it..... (You may want to be more careful with the positioning of the origin in your new coordinate frame though....)

Share on other sites
It's easiest to arbitrarily declare one of the triangle's sides as being parallel to the X or Y axis. So if you have a triangle and say its first side is 4 units long. You can just start by saying its two endpoints are at {0,0} and at {4,0}. Then you just have to calculate the position of the remaining point. You know the lengths of the other two sides; it's exactly same in 3D as in 2D since the triangle lies along a plane, and you can easily find equations online for finding the point given that you know all lengths (and all angles, as a result).

• 28
• 15
• 23
• 10
• 19