• Advertisement
Sign in to follow this  

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

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement