Hi all, David Spilling wrote: > Robert, > > Here we are again! > > Firstly, Farshid is right, even up to OSG 2.1.7. It looks like the "more > elegant" code I submitted way back in the thread "numerical precision > error" of 26/07/06 does break for this case. In particular : > > -1 0 0 > 0 0 -1 > 0 -1 0 > > should give a quat of (W,X,Y,Z)=(0,0,0.707,-0.707), and it doesn't, it > gives (0,0,0.707,0.707). > > In fact, this method seems to be wrong for any 180 degree rotations > about an axis which is not in the +X+Y+Z or -X-Y-Z octants. It's quite > odd to me that hasn't really been caught in >1 year of use. The > unittests code also makes a mistake in line 282-286 where the magnitude > of the quaternion components is checked rather than their sign.
Yes, you are right, the unittest mistake was mine. Your new unittest code does what I intended. > > Secondly, the Mk1 implementation, still in the code, gets this case > right. Can I tentatively suggest we revert to the Mk1 case? AFAIK we > only went to Mk2 because the code looked neater, and didn't seem to > break our tests. > > The round of updates a few months back was to do with the fact that the > sign() function in the Mk2 case, which returned either plus or minus one > (the correct behaviour) had been replaced by a signOrZero function, > which could return zero (undesired behaviour). The revert you refer to > was to do with this sign() function. > > Attached is a modified unittests.cpp, which correctly reports the errors > with Mk2 - you will notice that all of them occur at 180 degrees (i.e. W > is zero). I haven't yet reverted and tested the Mk1 code - it takes ages > to build on my machine - but Excel testing indicates that Mk1 will be OK. > > JP - as another person as deeply mired in (or tarred by) this as I am, > do you have an opinion? I am quite happy with Mk1, it has worked flawlessly for me since it was included and I have switched to it occasionally. Mk1 also matches code that I have in a math reference [1]. I also recommend making Mk1 the default. regards jp [1] 3D Math Primer for Graphics and Game Development - Dunn, Parberry. > > David > -- This message is subject to the CSIR's copyright, terms and conditions and e-mail legal notice. Views expressed herein do not necessarily represent the views of the CSIR. CSIR E-mail Legal Notice http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html CSIR Copyright, Terms and Conditions http://mail.csir.co.za/CSIR_Copyright.html For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR Legal Notice send a blank message with REQUEST LEGAL in the subject line to [EMAIL PROTECTED] NOTE: The CSIR (http://www.csir.co.za/) has formally adopted the open document format (ODF) as the standard to support open access to information. More information on the ODF is available at http://opendocumentfellowship.org/ and the official web site of the non-profit organisation for the Advancement of Structured Information Standards (http://www.oasis-open.org/home/index.php). The latest copy of OpenOffice can be downloaded from http://www.openoffice.org/. Enquiries regarding the CSIR's move to open source software can be directed to [EMAIL PROTECTED] This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

