[2.0]Bug in ArrayVector3::crossProduct, C Lib

Minor issues with the Ogre API that can be trivial to fix
Post Reply
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 987
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 12
Contact:

[2.0]Bug in ArrayVector3::crossProduct, C Lib

Post by Crashy » Fri Mar 01, 2019 10:02 am

Hi,

I've spotted a small typo with huge impact in the C Lib version of ArrayVector3::crossProduct, in the 2.0 branch
After a quick look it has been fixed in 2.1+ branches. As it is a very basic fix I don't think it's useful to make a PR just for that.

Current implementation is

Code: Select all

return ArrayVector3(
                (mChunkBase[1] * rkVec.mChunkBase[2]) -
                (mChunkBase[0] * rkVec.mChunkBase[1]),
                (mChunkBase[2] * rkVec.mChunkBase[0]) -
                (mChunkBase[0] * rkVec.mChunkBase[2]),
                (mChunkBase[0] * rkVec.mChunkBase[1]) -
                (mChunkBase[1] * rkVec.mChunkBase[0]) );
It should be:

Code: Select all

return ArrayVector3(
                (mChunkBase[1] * rkVec.mChunkBase[2]) -
                (mChunkBase[2] * rkVec.mChunkBase[1]), //<<<-----Here, 2 instead of 0
                (mChunkBase[2] * rkVec.mChunkBase[0]) -
                (mChunkBase[0] * rkVec.mChunkBase[2]),
                (mChunkBase[0] * rkVec.mChunkBase[1]) -
                (mChunkBase[1] * rkVec.mChunkBase[0]) );
                
0 x
Follow la Moustache on Twitter or on Facebook
Image

Post Reply