Sign in to follow this  

Generating the coordinates of a plane

This topic is 1452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Trying to develop a generic plane coordinates generator which takes the normal<N> and a point<P0> on the plane. Planning to render using OpenGL (with Bullet Physics). Will use the N dot (P - P0) = 0 equation. What are the optimized methods to follow ?

Share this post


Link to post
Share on other sites

I would suggest to parametrize the plane using two orthogonal vectors that lie inside. Then every point on the plane would have the form:

P0 + a*V0 + b*V1 where P0 is the origin V0,V1 are the orthogonal vectors and a,b are scalars (this is basically an affine 2d space defined in 3d space)

 

Hope this helps

Edited by CableGuy

Share this post


Link to post
Share on other sites

Trying to develop a generic plane coordinates generator which takes the normal<N> and a point<P0> on the plane. Planning to render using OpenGL (with Bullet Physics). Will use the N dot (P - P0) = 0 equation. What are the optimized methods to follow ?

Depends on what you want to do really with it. With a normal N and a point P0 on the plane you can at most say if a point is inside the plane or not. On the other hand if you take CableGuy's advice you can have kinda like 2 coords in your plane(like u,v coords for textures). I would go even further and tell you to make a whole new coordinate system for the plane, to even know if it's facing up or down. Basically I'd recommend you to have the plane coord system relative to the global one and this way you can get things done. Your X1 and Z1 basis vectors will define any point along the plane and Y1 will be your normal - telling you whether it looks up or down, the point P1 - the cneter of you new coord system would give you that P0 point in your plane.

 

Ex:

For your plane you have 3 basis vector(better orthogonal and normalized) and one point, I'd recommend you start by default with the 2 coordinate systems (plane and global), being the same, so you'd start with X1 = (1,0,0), Y1=(0,1,0), Z1=(0,0,1), P1=(0,0,0) (or homogeneous coordinates so you can do translations with matrix transformations too). Now you can always find the new basis vectors and center of the coordinate system of the plane relative to the global one after any transformation, and you can always do the same for a point/vector in the plane coordinate system. Let's say I rotate my plane along the X1 axis by applying the appropriate rotation matrix. Now if I have a point in plane coordinates, I can always get its global coordinates by applying the inverse rotation to that point and vice versa. Basically you'll calculate the matrix for the transformation between the global and the plane coord system and apply it on points/vectors to present them in different coord systems.

Edited by lightxbulb

Share this post


Link to post
Share on other sites

This topic is 1452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this