Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 assign 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?

share|cite|improve this question
up vote 2 down vote accepted

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?

share|cite|improve this answer
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.

share|cite|improve this answer
+1 since this is Marty Cohen's first answer post. – user285523 Nov 8 '15 at 4:14
Wow - you are right. – marty cohen Nov 8 '15 at 4:35

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.

share|cite|improve this answer

You have three 3D vectors defining your triangle: a, b, c

Since they lie on the same plane you only need angles and distances to compute relative 2D coordinates:

ab = b - a;
ac = c - a;
a' = ( 0, 0 );
b' = ( 0, length( ab ) )
c' = (
    cos( ab.angleTo( ac ) ) * length( ac ),
    sin( ab.angleTo( ac ) ) * length( ac )

You may want to inverse some axis

Or to use the dot product of vectors a b c with the camera axis vector instead of a b c ( so that the coordinates become parallel with the camera viewport )

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.