Archived

This topic is now archived and is closed to further replies.

scorpiomidget

3D point left or right of vector ?

Recommended Posts

Hi again, Is there some code that will tell me if a 3d point is on the left or right of a vector, where both the point and vector are on the same plane ? For instance, I have a polygon and I split this with a vector. I need to calculate which verts of the polygon are on the left of the vector and which are on the right. Scorpio

Share this post


Link to post
Share on other sites
Ok i can see that, sorry for not being clear.

I''d like to know if a 3d point is on the left or right of a vector, where the point and vector are on the same plane and i''m viewing the plane from the direction of the normal to the plane.

Can this be done ?

Share this post


Link to post
Share on other sites
I didn''t really understand exactly where you''re looking at it, but this is a solution: take the point, cross it with the vector, and compare it to the normal. If it has the same sign, then it''s on one side. If it''s negative, then it''s on the other side.

Share this post


Link to post
Share on other sites
I didn''t really understand exactly where you''re looking at it, but this is a solution: take the point, cross it with the vector, and compare it to the normal. If it has the same sign, then it''s on one side. If it''s negative, then it''s on the other side.

Share this post


Link to post
Share on other sites
quote:
Original post by yellowjon
I didn''t really understand exactly where you''re looking at it, but this is a solution: take the point, cross it with the vector, and compare it to the normal. If it has the same sign, then it''s on one side. If it''s negative, then it''s on the other side.

Hmmm... Don''t cross the point and the vector of the line. If O is a point on the line, v is the line''s direction, P is the point that should be tested, and n is the normal of the plane, then the "determinant" is:

d = (P - O) X v . n

if(d<0) it''s on one side, else it''s on the other side

Cédric

Share this post


Link to post
Share on other sites