Vector Reflection
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
Bah!
vReflection = vIncident - 2 * (vNormal * vNormal.transpose() ) * vIncident
?
Magmai Kai Holmlor
- The disgruntled & disillusioned
?
Magmai Kai Holmlor
- The disgruntled & disillusioned
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
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!
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!
Bah!
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.
-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.
John BlackburneProgrammer, The Pitbull Syndicate
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement