# How do I map a 3D triangle into 2D?

The problem I'm having is mapping a 3D triangle into 2 dimensions. I have three points in x,y,z form, and want to map them onto the plane described by the normal of the triangle, such that I end up with three points in x,y form.

My guess would be it'd assigning an arbitrary up vector... and then... doing something? Finding the distance traveled along the plane from one vertex to another...? What do I do, and how do I do it?

-

You have not specified the problem well enough. Do you have three points $(x_1,y_1,z_1), (x_2,y_2,z_2), (x_3,y_3,z_3)$ to map to two dimensional points? The simplest is to ignore the third coordinate. This is not as stupid as it sounds-you are projecting the triangle on the $xy$ plane. If you want to project onto another plane, how is it defined?

-
I've edited the question to make it a little more clear. I don't know if it's clear enough to explain what I want done, because honestly my understanding of the math involved is at such a rudimentary level I might not be able to properly formulate the question. Sorry. Is it clearer now? I want to basically imagine the plane the triangle lies in as being the new XY plane, and map into that. –  Ian Nafiri Jul 8 '11 at 3:05
If your vector is normal (perpendicular) to the plane you want to project onto, the operation is well-defined. You can rotate so that the vector is along $z$, ignore the last coordinate, then rotate back. You will have three points, each with three coordinates, that lie in a plane perpendicular to the vector you have chosen. Is that what you want? –  Ross Millikan Jul 8 '11 at 3:42
Exactly. Thanks. –  Ian Nafiri Jul 8 '11 at 4:28

My take on this is that you want to find a mapping of the form (x, y, z) -> (ax+by+cz, dx+ey+fz) so the resulting triangle in the plane is the same shape and size as the original triangle. Let Lij be the distance between points I and j. Since we have 6 unknowns, we need 6 equations. Let’s map (x1, y1, z1) into (0, 0). We get ax1+by1+cz1 = 0 and dx1+ey1+fz1 = 0. Let’s map (x2, y2, z2) into (L12, 0). We get ax2+by2+cz2 = L12 and dx2+ey2+fz2 = 0. Compute the point (u, v) which is L13 from (0, 0) and L23 from (L12, 0). The sine and cosine laws are your friends here. Map (x3, y3, z3) into (u, v) via ax3+bx3+cz3 = u and dx3+ey3+fz3 = v. Solve these two sets of 3x3 equations, and there’s your mapping.

-

Suppose the three vertices of the 3D triangle are given by three coordinate triples a, b, c. For example, b = {xb,yb,zb}. In Mathematica 10, a 2D triangle congruent to this 3D triangle is

SSSTriangle[Norm[b-a], Norm[c-b], Norm[a-c]]

I do not see an obvious way to use the original 3D coordinates to position the new triangle in 2D space. SSSTriangle uses an arbitrary but consistent placement.

-