[osg-users] TrackballManipulator possible bug; definite issue

J.P. Delport jpdelport at csir.co.za
Wed Nov 4 22:24:02 PST 2009


Hi,

Allen Saucier wrote:
> Hi,
> 
> I don't know if anyone has delt w/ this problem yet, but it appears
> that TrackballManipulator has a bug in it in the methods,
> setByMatrix() and computePosition().

I don't use setByMatrix() as there are limitations to what can actually 
be set by it, so I'm not sure if it's working OK for trackball. As you 
can see from the code, the eye and rotation can be recovered from the 
matrix, but not the focus position of the manipulator. This makes it 
difficult to properly hand over from one manipulator to another. Have a 
look at the following threads:

http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/8588
http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/14563
http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/19271

This issue has been on my todo list for a long time...

As for computePosition, I often use that (after setting distance, 
rotation and center) and have not had any problems with it.

Before looking at the way the matrix is filled in code (row vs column), 
include <osg/io_utils> and print out the matrices using << for the 
different manipulators.

jp


> 
> I could be wrong, as I'm a novice in OSG, but I have observed the
> following:
> 
> setByMatrix() 1. does not work for me as every time I call it, the
> camera's position & orientation are not altered or updated 2. the
> code "appears" to be incorrect compared to other manipulator examples
> which work.
> 
> from NodeTrackerManipulator: void
> NodeTrackerManipulator::setByMatrix(const osg::Matrixd& matrix) { 
> osg::Vec3d eye,center,up; matrix.getLookAt(eye,center,up,_distance); 
> computePosition(eye,center,up); }
> 
> this code works. But from TrackballManipulator:
> 
> void TrackballManipulator::setByMatrix(const osg::Matrixd& matrix) { 
> _center = osg::Vec3(0.0f,0.0f,-_distance)*matrix; _rotation =
> matrix.getRotate(); }
> 
> This code does NOT work.
> 
> 
> as for computePosition() 1. in TrackballManipulator, it appears to be
> using COLUMN MAJOR matrices but OSG is row major. 2. as compared to
> NodeTracker and Terrain manipulators, the method for computing the
> position/orientation is consistent.  However, in the Trackball it is
> performed using, I believe, an invalid way to fill a matrix with
> rotation/orientation information.
> 
> Has anyone else encountered this?
> 
> ...
> 
> Thank you!
> 
> Cheers, Allen
> 
> ------------------ Read this topic online here: 
> http://forum.openscenegraph.org/viewtopic.php?p=19184#19184
> 
> 
> 
> 
> 
> _______________________________________________ osg-users mailing
> list osg-users at lists.openscenegraph.org 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
> 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

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.



More information about the osg-users mailing list