Page 1 of 1

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

Posted: Fri Mar 01, 2019 10:02 am
by Crashy
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]) );