Re: [osg-users] View matrix center

2008-02-11 Thread J.P. Delport
Hi,

have a look at these two threads. I've done something similar to what I 
think you are looking for, but had to add some functionality. Look for 
the getDRC function.

http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/19873/match=DRC

http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/8612/match=DRC

Robert seemed keen to add functions to the manipulators/the base to 
enhance them in this direction, so if you find a good solution and have 
time for a submission...

cheers
jp

Jean-Sébastien Guay wrote:
 Hi Paul,
 
 Thanks for the lookAt background, very useful.
 
 Yep, read the code. Look for something like getCenter in
 MatrixManipulator, that would be a good start.
   
 
 I'm already going down that road. Trouble is MatrixManipulator doesn't 
 have getCenter(). TrackballManipulator does, and using that works, but 
 I'd prefer not to assume the manipulator will be of any particular type 
 (other than the base MatrixManipulator).
 
 I'm left with using getMatrix(), but if this is also a lookat matrix, 
 I'll have the same problem... Any other leads?
 
 Thanks,
 
 J-S
 

-- 
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.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] View matrix center

2008-02-07 Thread Jean-Sébastien Guay
Hi Paul,

Thanks for the lookAt background, very useful.

 Yep, read the code. Look for something like getCenter in
 MatrixManipulator, that would be a good start.
   

I'm already going down that road. Trouble is MatrixManipulator doesn't 
have getCenter(). TrackballManipulator does, and using that works, but 
I'd prefer not to assume the manipulator will be of any particular type 
(other than the base MatrixManipulator).

I'm left with using getMatrix(), but if this is also a lookat matrix, 
I'll have the same problem... Any other leads?

Thanks,

J-S

-- 
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] View matrix center

2008-02-07 Thread John Donovan
Jean-Sébastien Guay wrote:
  The eye point is as expected, but instead I get center = (0,-39,0).

Presumably because getViewMatrixAsLookAt() doesn't do any magic, it just takes 
the Y axis (in this case) of the matrix as the view vector. This vector will be 
normalised (otherwise the camera would do funky things), so all it can do is 
subtract this unit vector from the eye position.
I guess the manipulator has some notion of the point about which it orbits, but 
I couldn't tell you what that is off-hand. The header will tell you, no doubt.

-JD, who is pressing all the right keys, just not necessarily in the right 
order.



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] View matrix center

2008-02-07 Thread Jean-Sébastien Guay
Hello,

A quick question about the camera view matrix.

I have a viewer which is close to the default osgviewer, with the 
default camera manipulator. I can see that at startup, the camera is at, 
say, (0,-40,0) (looking down the positive Y axis, with the +Z up 
convention). I can also see that I am orbiting around the origin (0,0,0).

So I would expect that using camera-getViewMatrixAsLookAt(eye, center, 
up) would give
eye = (0,-40,0)
center = (0,0,0)

The eye point is as expected, but instead I get center = (0,-39,0).

Why is this? Is that a result of the manipulator? Do I need to get one 
of the manipulator's properties in order to get the value I need? I 
really need both the correct eye point and the actual point the camera 
is orbiting around...

Thanks in advance,

J-S

-- 
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] View matrix center

2008-02-07 Thread Paul Martz
 Presumably because getViewMatrixAsLookAt() doesn't do any 
 magic, it just takes the Y axis (in this case) of the matrix 
 as the view vector. This vector will be normalised (otherwise 
 the camera would do funky things), so all it can do is 
 subtract this unit vector from the eye position.

The name 'center' is probably a misnomer here, and certainly has nothing to
do with the orbital center of the manipulator.

getViewMatrixAsLookAt has its roots in the gluLookAt function. The second
parameter is a point that your eye is looking at. Of course there are
several points that your eye is looking at, all along the view vector, and
you could call gluLookAt with any one of those points and still create the
same matrix. I've always remembered the three params to gluLookAt as look
(the eye position), at (where your gaze is directed), and up. Why the
second param is called center instead of at, I don't know, probably some
kind of historical reason.

 I guess the manipulator has some notion of the point about 
 which it orbits, but I couldn't tell you what that is 
 off-hand. The header will tell you, no doubt.

Yep, read the code. Look for something like getCenter in
MatrixManipulator, that would be a good start.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
303 859 9466

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org