1
Bugs / Reflected vector is inverted
« on: February 26, 2013, 09:51:57 pm »
I think SimpleVector.reflect returns a vector which is -1* the correct reflection. Example:
Result is: v=(1.0,2.0,3.0) normal=(0.0,-1.0,0.0) vr=(-1.0,2.0,-3.0)
I expect the reflection to be (1, -2, 3). Same result regardless of whether the normal vector points toward or away from the input vector.
Code: [Select]
SimpleVector v = new SimpleVector(1.0f, 2.0f, 3.0f);
SimpleVector normal = new SimpleVector(0, -1.0f, 0);
SimpleVector vr = v.reflect(normal);
Log.i("reflect", "v="+v+" normal="+normal+" vr="+vr);
Result is: v=(1.0,2.0,3.0) normal=(0.0,-1.0,0.0) vr=(-1.0,2.0,-3.0)
I expect the reflection to be (1, -2, 3). Same result regardless of whether the normal vector points toward or away from the input vector.