**0**

# 3d coplanar points to 2d coordinates

Started by Feb 01 2006 12:13 AM

,
1 reply to this topic

###
#1
Members - Reputation: **410**

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.

###
#2
Members - Reputation: **2078**

Posted 01 February 2006 - 01:14 AM

Quote: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:

Original post by yapposai

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?

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.

Then they should be ready for display in your 2d graph.