Archived

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

How to create a Plane from a point and a direction vector ???

This topic is 5340 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

Hi Well, this is my problem.. Imagine i have a point, lets call it L. That point is my is my light source. This point has a direction to wich it is pointing to, lets call it D. Now, i would need to know a plane that contains L, and is allways perpendicular with the direction vector D. How can i make this ? I posted two pics here: http://projectfy.fysoftware.com/temp/p1.jpg http://projectfy.fysoftware.com/temp/p2.jpg to show what i mean, being the plane that i want to find the thickest black line there. Can anyone help ? thanks, Bruno

Share this post


Link to post
Share on other sites
Maybe you''re looking fo rthe scalar equation of a plane?

Had to grab the old algebra book for this, and here''s what I found...


The plane through P0(x0,y0,z0) with a normal n=[a b c] has the equation

a(x-x0) + b(y-y0) + c(z-z0) = 0

In other words, a point P(x,y,z) lies in the plane if and only if x, y and z satisfy this equation.

example:

The plane through P0(-2,3,5) with normal n=[7 -4 8] has equation
7(x-(-2))-4(y-3)+8(z-5)=0.

This simplifies to 7x-4y+8=14.


So, looking at your numbers for the first picture I came up with x+y+z=6 for the equation of that plane and for the second picture I got 2x-y+2z=6 for that plane.

Of course, check the math - I''m horrible with math (except telling a computer how to do it )

Share this post


Link to post
Share on other sites
ouch... lol
thanks DGates..

I''l explain a bit more.
This part of the code is needed to remove the back projection of a projective texture, that''s why i need a plane, to clip away the geometry behind my projector.

So, in my case with a Light L(2,2,2) and a direction of D(3,4,5) i would do this ?

a(2-3) + (2-4)b + (2-5)c = 0 , right ?



Share this post


Link to post
Share on other sites
hmm, thinking better, only like that would not work, as it''s not taking in consideration the angle of the light projection, right ?

Share this post


Link to post
Share on other sites
quote:
Original post by Bruno
a(2-3) + (2-4)b + (2-5)c = 0 , right ?



No. You have inserted the position of your light source as (x, y, z). This point should never satisfy the equation. All points (x, y, z) that satisfy the equation are part of the plane though.

Share this post


Link to post
Share on other sites
quote:
Original post by Bruno
So, in my case with a Light L(2,2,2) and a direction of D(3,4,5) i would do this ?

a(2-3) + (2-4)b + (2-5)c = 0 , right ?



The normal is the a,b,c part, so you would get:
3(x-2) + 4(y-2) + 5(z-2) = 0
3x + 4y + 5z = 18

Any point (x,y,z) that satisfies that equation is on the plane.

Share this post


Link to post
Share on other sites
if you just want to find out if a point is behind a vector, your light in this case, just take the dot product of the lights direction vector with the vector from the position of the light to the point to check. if the outcome is positive, the point is on the same side as the direction vector.
so if P is a point to test for, do:

If D . (P-L)>0 //render point P

[edited by - eelco on May 1, 2003 5:53:29 AM]

Share this post


Link to post
Share on other sites