Sign in to follow this  

Direction vector along plane?

This topic is 4102 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 This is probably basic high school maths or something that everyone else learned in kindergarten, but somehow I missed out along the way. So if anyone knows a pre-schooler who can answer this question for me, I'd be very appreciative. :) Lets say I have a plane, and I know it's equation. And I have an object, traveling in a direction along a vector that collides with the plane. I have detected the collision, and all is well with the world. But I then want the object to "slide" along the plane in the same general direction is was heading, but without passing thru the plane. So what I'm asking is, how do I work out the direction vector along the plane, from the plane equation and the original vector? I'm thinking there must be some way of "projecting" the direction vector onto the plane so that I have a new 3D vector which points along the surface of the plane? I really hope this makes sense. I've been reading thru all sorts of vector maths stuff, but because I don't know what this method would be called, I'm not sure what to look for. Any help would be greatly appreciated! Rob.

Share this post


Link to post
Share on other sites
Quote:
Original post by UselessRob
I'm thinking there must be some way of "projecting" the direction vector onto the plane so that I have a new 3D vector which points along the surface of the plane?

Don't sell yourself short, what you're looking for is precisely called projection [smile] You first project the vector onto the plane normal, and then subtract that from the original vector. What you end up with is a vector on the plane representing the projection of the original vector. The formula is v' = v - (v.n - d)n, where 'v' is the original vector, 'n' is the plane normal, 'd' is the plane distance, and 'v'' is the projected vector. (v.n - d) tells you how far away the vector is from the plane. Multiply that by 'n' gives you a vector with that length which is parallel to the normal. If you then subtract this vector from 'v', then you end up with the projection 'v''. This might be different from equations you would find online for projections, since a projection in the pure mathematical sense is onto a subspace (meaning d = 0), and you wouldn't see that subtraction term.

Share this post


Link to post
Share on other sites
Hmm. I think of a slightly different solution:

If v is the original direction of motion and n is the plane normal (assuming unit length for simplicity of projection) then IMHO the original motion vector can be splitted into a part v perpendicular to the plane and a part v|| parallel to the plane, so that
v := v + v||
Now, with n being of unit length, the perpendicular part can be expressed as the projection
v := ( v . n ) n
where the dot product computes the projected length, and the scaling of n reconstructs the direction.

Substitution and re-arrangement yields in
v|| = v - ( v . n ) n

For a direction vector there is no definition of a distance. So I don't see how the plane's distance should appear in the wanted problem solution?! Please correct me if I'm wrong.


EDIT: I hope your browsers show up the ⊥ correctly, my doesn't do so :(

[Edited by - haegarr on September 18, 2006 3:10:44 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
For a direction vector there is no definition of a distance. So I don't see how the plane's distance should appear in the wanted problem solution?! Please correct me if I'm wrong.

No you're right, it was early in the morning and I was thinking of points [smile]

Share this post


Link to post
Share on other sites

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