Re: [osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-06 Thread Alberto Luaces
John Galt writes:

 What is happening is that the eye instead of being fixed at say (X1,Y1,Z1) is 
 revolving around that point in a small circle while pointing to the correct 
 center!

See src/osg/Matrix_implementation.cpp, line 922:

preMultTranslate(-eye);

The origin of the camera is set fixed at the eye point, so if it is
not, is because of something else.

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


Re: [osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-05 Thread John Galt
Hi,

What is happening is that the eye instead of being fixed at say (X1,Y1,Z1) is 
revolving around that point in a small circle while pointing to the correct 
center!

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26472#26472





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


Re: [osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-03 Thread Robert Osfield
Hi John,

I'm not going to dive into trying to understand your maths, there are
plenty of stuff about vector maths on the web as a resource to draw
upon that could explain things much better than I could.  On the OSG
side you have setViewMatrixAsLookAt which is standard gluLookAt
behavior, or setViewMatrix(matrix) which again is using straight
OpenGL conventions.

I would also add that the OSG doesn't directly try to dabble in
Euler/HPR coordinate setup as there are so many different ways to
interpret them.  The OSG provides the maths support in osg::Matrix for
you to go an implement things how you like them.

Robert.

On Sat, Apr 3, 2010 at 3:51 AM, John Galt manu9ak...@gmail.com wrote:
 Hi,

 I am using the setViewMatrixAsLookAt to set up my camera.

 I have set up my camera as follows:


 viewer.getCamera()-setViewMatrixAsLookAt(osg::Vec3(XCoordinate,YCoordinate,ZCoordinate),
  osg::Vec3(XCoordinate - 
 10*cos(osg::DegreesToRadians(Pitch))*sin(osg::DegreesToRadians(Yaw)),YCoordinate
  + 
 10*cos(osg::DegreesToRadians(Pitch))*cos(osg::DegreesToRadians(Yaw)),ZCoordinate
  + 10*sin(osg::DegreesToRadians(Pitch))), osg::Vec3(0.0, 0.0, 1.0));


 My XCoordinate, YCoordinate and ZCoordinate values remain constant over the 
 whole code and the values of Roll, Pitch, Yaw change and yet when the Roll, 
 Pitch, Yaw are changed, the position of the camera's eye is being changed. 
 Even though I defined the eye's position as 
 osg::Vec3(XCoordinate,YCoordinate,ZCoordinate). Seems a bit odd for me to 
 understand why this is happening.

 Thank you!

 Cheers,
 John

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=26403#26403





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

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


Re: [osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-03 Thread Alberto Luaces
John,

you can compose the rotation (roll, pitch, yaw) matrices yourself or
have a look at osgSim::DOFTransform documentation. Then, set the
position and orientation of the camera with
viewer.getCamera()-setViewMatrix().

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


[osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-02 Thread John Galt
Hi,

I am using the setViewMatrixAsLookAt to set up my camera.

I have set up my camera as follows:


 viewer.getCamera()-setViewMatrixAsLookAt(osg::Vec3(XCoordinate,YCoordinate,ZCoordinate),
  osg::Vec3(XCoordinate - 
 10*cos(osg::DegreesToRadians(Pitch))*sin(osg::DegreesToRadians(Yaw)),YCoordinate
  + 
 10*cos(osg::DegreesToRadians(Pitch))*cos(osg::DegreesToRadians(Yaw)),ZCoordinate
  + 10*sin(osg::DegreesToRadians(Pitch))), osg::Vec3(0.0, 0.0, 1.0));


My XCoordinate, YCoordinate and ZCoordinate values remain constant over the 
whole code and the values of Roll, Pitch, Yaw change and yet when the Roll, 
Pitch, Yaw are changed, the position of the camera's eye is being changed. Even 
though I defined the eye's position as 
osg::Vec3(XCoordinate,YCoordinate,ZCoordinate). Seems a bit odd for me to 
understand why this is happening.

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26403#26403





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


Re: [osg-users] Bizzare setViewMatrixAsLookAt behavior !!

2010-04-02 Thread John Galt

Redbeard wrote:
 Hi,
 
 I am using the setViewMatrixAsLookAt to set up my camera.
 
 I have set up my camera as follows:
 
 
  viewer.getCamera()-setViewMatrixAsLookAt(osg::Vec3(XCoordinate,YCoordinate,ZCoordinate),
   osg::Vec3(XCoordinate - 
  10*cos(osg::DegreesToRadians(Pitch))*sin(osg::DegreesToRadians(Yaw)),YCoordinate
   + 
  10*cos(osg::DegreesToRadians(Pitch))*cos(osg::DegreesToRadians(Yaw)),ZCoordinate
   + 10*sin(osg::DegreesToRadians(Pitch))), osg::Vec3(0.0, 0.0, 1.0));
 
 
 My XCoordinate, YCoordinate and ZCoordinate values remain constant over the 
 whole code and the values of Roll, Pitch, Yaw change and yet when the Roll, 
 Pitch, Yaw are changed, the position of the camera's eye is being changed. 
 Even though I defined the eye's position as 
 osg::Vec3(XCoordinate,YCoordinate,ZCoordinate). Seems a bit odd for me to 
 understand why this is happening.
 
 Also, if I know the camera's location(X,Y,Z) and orientation (Roll, Pitch, 
 Yaw), is there any easy function to set the view of the camera instead of 
 doing vector math on paper and setting it up using (eye, dir, up)?
 
 
 Thank you!
 
 Cheers,
 John


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26404#26404





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