• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# 3d coplanar points to 2d coordinates

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1yapposai  Members

Posted 01 February 2006 - 12:13 AM

Hello everyone, I have a set of points which lie on the same plane along with the normal of the plane. The points are from cutting a 3d model along the plane. The problem is I need to draw the points in a 2d graph (X,Y) so I need a way to remove a 3rd coordinate from the 3d points. right now I just have a switch to check if the normal of the plane is a specific axis (X,Y,Z) but I just found out that arbitrary cutting planes are possible. I am thinking that I need to rotate, translate the 3d points by a matrix to map them into the XY (UV) axis but I am not sure how to get the matrix from only the normal of the plane. From my limited understanding don't you need at least 1 more vector aside from the plane normal to define the U or V direction since you can rotate the plane around the normal? Any help is much appreciated. Thanks.

### #2scgames  Members

Posted 01 February 2006 - 01:14 AM

Quote:
 Original post by yapposaiHello everyone,I have a set of points which lie on the same plane along with the normal of the plane. The points are from cutting a 3d model along the plane.The problem is I need to draw the points in a 2d graph (X,Y) so I need a way to remove a 3rd coordinate from the 3d points.right now I just have a switch to check if the normal of the plane is a specific axis (X,Y,Z) but I just found out that arbitrary cutting planes are possible.I am thinking that I need to rotate, translate the 3d points by a matrix to map them into the XY (UV) axis but I am not sure how to get the matrix from only the normal of the plane. From my limited understanding don't you need at least 1 more vector aside from the plane normal to define the U or V direction since you can rotate the plane around the normal?
Yeah, you got it. You can't uniquely define a basis from a single vector (the normal), so you'll have to construct an arbitrary basis. A typical way to do this is to:

1. Make the normal the z axis of the basis
2. Cross z with the cardinal axis with which it is least aligned (in the order cross(worldAxis,z))
3. Normalize the result to get the x axis
4. Cross z with x to get the y axis

You'll then need to choose an origin for the coordinate system - perhaps the average of the input points? Then you can transform the points into this coordinate system and discard the z components (they won't necessarily be non-zero due to numerical error, but they'll be close enough). If at that point the points aren't oriented the way you want, you could apply a rotation.