Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixed small mathematical errors. #26
The first issue in src/collide_fine.cpp was something I noticed from the book, where the contactPoint's value gets overwritten when it should just be displaced by the vertexPos vector.
The issue in Matrix4::getDeterminant() I noticed when I was trying to use the matrix inverse method for the first time. For a rotation matrix I had, the determinant was returning an incorrect value which I confirmed with my calculator and various online tools. I have derived the Matrix4 determinant method again below:
Since the matrix d is multiplied by has all zeros for the last row, it has a determinant of 0. Since each of the remaining three matrices have two zeros in the bottom row, they each reduce to the 2x2 matrix made of the top left corner of each matrix. Therefore we have:
Substituting in a = data, b = data, and so on we get:
Which is equivalent to the old code (just in a different order):
With the exception of the first line needing to be negative.
If I messed up, I apologize for wasting your time. I've absolutely loved reading and implementing things from your book.