4
$\begingroup$

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?

4 Answers 4

0

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 )

3

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.

  • 0
    Wow - you are right.2015-11-08
2

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?

  • 0
    Exactly. Thanks.2011-07-08
0

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.