Re: JavaScript semantic change
Posted: Sat Dec 18, 2010 9:03 pm
I didn't realise we had a dot product for quaternions. I did know it was useful to compare the alignment of two vectors. I just put the code in script and compared the dot product from two similar player orientations. It is either 1.0 or a number with at least the first 6 digits equal 1:Ahruman wrote:I’m going through Quaternion’s properties to write unit tests, and wondered what the quaternion dot product was actually good for. It turns out that it’s a good measure of difference; similar normalized quaternions have a dot product near 1. For example, oldOrientation.dot(currentOrientation) > 0.999 will detect changes of more than about five degrees around any axis.
Code: Select all
dot product: 1.0000001192092896
dot product: 1