Advertisement

ADVANCED VECTOR RELFECTION

Started by December 13, 2002 08:23 PM
15 comments, last by LewieM80 22 years, 2 months ago
How would I relect vector A about J which is an arbitrary axis? -Lewis [m80] Play QUADz MX @ www.m80produxions.com
Lewis [m80]Interactive Designerhttp://ismstudios.com
You would use some equations.

R = U - 2(N.U)N

U and N are normalized. U represents the point you want to reflect, and N is the normal. ''.'' means the dot product.
Advertisement
thanx man i really appreciate it... i was going crazy at barnes and noble trying to dig up stuff.

-Lewis [m80]
Play QUADz MX @
www.m80produxions.com
Lewis [m80]Interactive Designerhttp://ismstudios.com
I have a question about that formula. Can the normal represent the axis I''m reflecting about, or does it have to be the orginal line''s normal... or am I screwing myself up?

-Lewis [m80]
Play QUADz MX @
www.m80produxions.com
Lewis [m80]Interactive Designerhttp://ismstudios.com
The normal represents the vector perpendicular to the plane you are reflecting off of.
Yup, you can''t reflect a vector about an arbitrary axis, unless you tell us what you mean.

Or, unless you are in 2D, in which case, N is the normal of the axis (i.e: a vector perpendicular to it).

Cédric
Advertisement
Yes you can.

To GameDev.net Forums
Et tu Brute[And you Brutus.]
I got this little trick from Lamothe''s latest book. I am using 2D vectors and I ended with something similar to the caculation above.

I first found the normal to the surface I''m bouncing off of. (this can easily be done by calculating the vector that when added with the surface''s slope, is then equal to -1. In essense: x2 = -y1, y2 = x1) This will be my axis. Then I calculate the incoming vector''s dot product with this normal. This, of course, gives me a scalar number so I multiply it by the normal (my axis) again to get a vector.

Now what I have is a "shadow" of the incoming vector, let''s call this N. I can now add the incoming vector, let''s call it "I", with N. I now get a vector that connects these two. Let''s call it L...

If I now add N plus L, I get my reflected vector! I''m such a geek... I''ve been told. Of course, all of this boils down to a simple formula but I thought you guys might want to know where I"m coming from.

I found that if you work these out graphically, it''s so much easier to understand! Enjoy!

-Lewis [m80]
Play QUADz MX @
www.m80produxions.com
Lewis [m80]Interactive Designerhttp://ismstudios.com
"Real-time Rendering" Muller and Haines is a good book for formulas.
Keys to success: Ability, ambition and opportunity.
I''ve got an idea for the poster. Why don''t you try drawing your problems out on paper and using fundemental trig functions to derive your own formula. And then compare the efficiency of these generic formulae to your own. I try to do this, but I''m a newbie, you could say, in the world of mathematics, and right now I''m trying to find the logic of how the trig functions were derived from a pythagorean tripple. Knowing this, I think I can interpret all of this vector notation better.

Plz excuse my English, I''m from the United States.

This topic is closed to new replies.

Advertisement