Archived

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

obLaho

Vector Reflection

Recommended Posts

Heres a question you bright sparks should be able to answer ; I have a vector and I would like to reflect it off a plane. I have the normal of the surface already and the camera vector. How would I calculate the reflection vector? I have this formula; R = I - 2(N NT)I R = Reflected vector I = Incidence vector N = Normal vector NT = Transposed Normal (Pseudo)source code would be helpful, prizes will be issued ... Many thanks obLaho

Share this post


Link to post
Share on other sites
Very cute.

As I understand it, you cannot transpose a vector, but you can convert the vector to a 3x1 or a 1x3 matrix and transpose it that way. Am I correct?

Bah!

Share this post


Link to post
Share on other sites
One way is using Geometric Algebra: if m is an initial and n a unit normal to a plane then the reflected vector is

-nmn

The products nm and (nm)n are both the standard product from geometric algebra, and this application of it is covered by any course or book on the subject. This is far more useful than other techniques as apart from being very simple it works in any dimension, not just in 3D.

Share this post


Link to post
Share on other sites