Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Aaaah, that explains some of what I'm seeing. Hum... Using the TerrianManipulator is different from the trackball manipulator but the idea is the same: setByMatrix I have been assuming to capture the entire state of the manipulator and to properly situate my camera exactly where I want and at the rotation I want. Guy, I am trying to rotate the camera 90 degrees with respect to a local coordinate frame. The local coordinate frame is actually @ the edge of the earth (a sphere or ellipsoid) so the camera must be orientated on the terrain at a 90 degree angle to it. Thank you both for your response. I appreciate the help! J.P. Delport wrote: Hi Allen, the problem with setMatrix is that it cannot fully encapsulate the state of the manipulator. Internally the manipulator (trackball) uses a distance, rotation and center, but all these variables do not fit into a matrix. The manipulator can calc a matrix from the internal variables, but not set them properly from an input matrix. E.g. the view might look OK, but the rotation point is somewhere weird. Some pointers to the past: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/8588/focus=8612 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/19271/focus=19873 jp Allen Saucier wrote: Hi, thanks JP! :) I really appreciate your response. It appears I am fighting something I didn't expect and something I don't fully understand: the terrain manipulator. I understand what you've proposed but when I call the fucntion: setByMatrix() w/in the terrain manipulator, that function appears to be doing something to the matrix I send in that I am not expecting. What you've proposed is pretty much what I do except that I'm using quaternions and then converting those quats into matrices. So I can move the cam and I can even rotate it on the Z axis which is the position vector coming from the ECEF origin to the point on the terrain I'm working with and the cam is looking directly down that Z axis (local z-axis). It's just when I do a 90 degree rotation about the local x or y axis I get something totally screwed up and I don't know why but I think the mystery is w/in the terrain manipulator which I've not investigated more thoroughly as yet. I am hoping someone who has in depth knowledge about the terrain manipulator will see this post buzz me back on it. I have very limited understanding of the manipulator code w/in OSG as I'm still a novice w/ OSG so I get all mixed up when I delve into any of the manipulator classes: trackball, nodetracker and now terrain. thanks though! Thank you! Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25590#25590 ___ osg-users mailing list 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. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25722#25722 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Hi Allen, I have a terrain manipulator I hope to release soon (which is ill-defined for where I work). For inspiration you can also look at the earth manipulator in osgEarth. jp Allen Saucier wrote: Aaaah, that explains some of what I'm seeing. Hum... Using the TerrianManipulator is different from the trackball manipulator but the idea is the same: setByMatrix I have been assuming to capture the entire state of the manipulator and to properly situate my camera exactly where I want and at the rotation I want. Guy, I am trying to rotate the camera 90 degrees with respect to a local coordinate frame. The local coordinate frame is actually @ the edge of the earth (a sphere or ellipsoid) so the camera must be orientated on the terrain at a 90 degree angle to it. Thank you both for your response. I appreciate the help! J.P. Delport wrote: Hi Allen, the problem with setMatrix is that it cannot fully encapsulate the state of the manipulator. Internally the manipulator (trackball) uses a distance, rotation and center, but all these variables do not fit into a matrix. The manipulator can calc a matrix from the internal variables, but not set them properly from an input matrix. E.g. the view might look OK, but the rotation point is somewhere weird. Some pointers to the past: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/8588/focus=8612 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/19271/focus=19873 jp Allen Saucier wrote: Hi, thanks JP! :) I really appreciate your response. It appears I am fighting something I didn't expect and something I don't fully understand: the terrain manipulator. I understand what you've proposed but when I call the fucntion: setByMatrix() w/in the terrain manipulator, that function appears to be doing something to the matrix I send in that I am not expecting. What you've proposed is pretty much what I do except that I'm using quaternions and then converting those quats into matrices. So I can move the cam and I can even rotate it on the Z axis which is the position vector coming from the ECEF origin to the point on the terrain I'm working with and the cam is looking directly down that Z axis (local z-axis). It's just when I do a 90 degree rotation about the local x or y axis I get something totally screwed up and I don't know why but I think the mystery is w/in the terrain manipulator which I've not investigated more thoroughly as yet. I am hoping someone who has in depth knowledge about the terrain manipulator will see this post buzz me back on it. I have very limited understanding of the manipulator code w/in OSG as I'm still a novice w/ OSG so I get all mixed up when I delve into any of the manipulator classes: trackball, nodetracker and now terrain. thanks though! Thank you! Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25590#25590 ___ osg-users mailing list 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. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25722#25722 ___ osg-users mailing list osg-users@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. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Hi Allen, the problem with setMatrix is that it cannot fully encapsulate the state of the manipulator. Internally the manipulator (trackball) uses a distance, rotation and center, but all these variables do not fit into a matrix. The manipulator can calc a matrix from the internal variables, but not set them properly from an input matrix. E.g. the view might look OK, but the rotation point is somewhere weird. Some pointers to the past: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/8588/focus=8612 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/19271/focus=19873 jp Allen Saucier wrote: Hi, thanks JP! :) I really appreciate your response. It appears I am fighting something I didn't expect and something I don't fully understand: the terrain manipulator. I understand what you've proposed but when I call the fucntion: setByMatrix() w/in the terrain manipulator, that function appears to be doing something to the matrix I send in that I am not expecting. What you've proposed is pretty much what I do except that I'm using quaternions and then converting those quats into matrices. So I can move the cam and I can even rotate it on the Z axis which is the position vector coming from the ECEF origin to the point on the terrain I'm working with and the cam is looking directly down that Z axis (local z-axis). It's just when I do a 90 degree rotation about the local x or y axis I get something totally screwed up and I don't know why but I think the mystery is w/in the terrain manipulator which I've not investigated more thoroughly as yet. I am hoping someone who has in depth knowledge about the terrain manipulator will see this post buzz me back on it. I have very limited understanding of the manipulator code w/in OSG as I'm still a novice w/ OSG so I get all mixed up when I delve into any of the manipulator classes: trackball, nodetracker and now terrain. thanks though! Thank you! Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25590#25590 ___ osg-users mailing list osg-users@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. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Is your viewing camera also using the local coordinate system (i.e geocentric)? Guy -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25621#25621 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Hi, thanks JP! :) I really appreciate your response. It appears I am fighting something I didn't expect and something I don't fully understand: the terrain manipulator. I understand what you've proposed but when I call the fucntion: setByMatrix() w/in the terrain manipulator, that function appears to be doing something to the matrix I send in that I am not expecting. What you've proposed is pretty much what I do except that I'm using quaternions and then converting those quats into matrices. So I can move the cam and I can even rotate it on the Z axis which is the position vector coming from the ECEF origin to the point on the terrain I'm working with and the cam is looking directly down that Z axis (local z-axis). It's just when I do a 90 degree rotation about the local x or y axis I get something totally screwed up and I don't know why but I think the mystery is w/in the terrain manipulator which I've not investigated more thoroughly as yet. I am hoping someone who has in depth knowledge about the terrain manipulator will see this post buzz me back on it. I have very limited understanding of the manipulator code w/in OSG as I'm still a novice w/ OSG so I get all mixed up when I delve into any of the manipulator classes: trackball, nodetracker and now terrain. thanks though! Thank you! Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25590#25590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Hi, I am having some extreme difficulty in rotating my viewing camera 90 degrees with respect to a local coordinate system. Local coordinate system: (in geocentric measure) mine is at the edge of the earth; i.e. i'm using a spherical earth. here is how I compute the local axes: fuctionName ( osg::PositionAttitudeTransform pax ) { osg::vec3d objectLocation = pax-getPosition(); // where x,y,z are -678468.2, -5405095.0, 3682910.3 osg:;quat qOrient = pax-getAttitude(); osg::vec3d up(0,0,1); // z axis of the earth or World coordinates osg::vec3d x_axis = up ^ objectLocaction; osg::vec3d y_axis = objectLocaction ^ x_axis; x_axis.normalize(); y_axis.normalize(); osg::Quat qRotAboutAxisByDegree; qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); osg::Quat qNewOrient = qOrient * qRotAboutAxisByDegree; s_mtxdIrCamPosOrientOri = osg::matrix::rotate(qNewOrient) * osg::matrix::translate(objectLocation); } 1. I know for a fact that the pax is set correctly with position attitude because my objects are being placed on my terrain, which is georeferenced terrain, correctly; i.e. they are perpendicular w/ the terrain and sit nicely on it. 2. the above code snippet actually works for rotation about the local Z axis and I am looking straight down at my terrain; i.e. directly down the local Z axis. 3. I want to rotate the camera up 90 degrees and be looking down the positive X axis. 4. I have tried replacing qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); with qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), x_axis); and I get the camera rotated about some axis I am NOT sure of and I am looking at the terrain from a peculiar angle, though I know not what angle. 5. I am using the TerrainManipulator as my scene matrix manipulator, if that helps. Would someone please give me insight as to how to do this? I would be greatly appreciative as the solution is totally eluding me. :O ... Thank you! Thank you very much. Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25471#25471 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: how to rotate view camera 90 degrees in relationship to terrain
Hi, I didn't try to follow your code, but here's and overview of how we do it: Have a camera/manipulator makeLookAt command that takes eye, center and up vectors. (These can be converted to the osg manipulators' distance, rotation, center). Have a transformation matrix from ECEF coords to local coords. Assume the camera is positioned/rotated in ECEF. In the local coords calculate eye, center, up. Convert to ECEF using the transformation matrix and stick into makeLookAt. jp Allen Saucier wrote: Hi, I am having some extreme difficulty in rotating my viewing camera 90 degrees with respect to a local coordinate system. Local coordinate system: (in geocentric measure) mine is at the edge of the earth; i.e. i'm using a spherical earth. here is how I compute the local axes: fuctionName ( osg::PositionAttitudeTransform pax ) { osg::vec3d objectLocation = pax-getPosition(); // where x,y,z are -678468.2, -5405095.0, 3682910.3 osg:;quat qOrient = pax-getAttitude(); osg::vec3d up(0,0,1); // z axis of the earth or World coordinates osg::vec3d x_axis = up ^ objectLocaction; osg::vec3d y_axis = objectLocaction ^ x_axis; x_axis.normalize(); y_axis.normalize(); osg::Quat qRotAboutAxisByDegree; qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); osg::Quat qNewOrient = qOrient * qRotAboutAxisByDegree; s_mtxdIrCamPosOrientOri = osg::matrix::rotate(qNewOrient) * osg::matrix::translate(objectLocation); } 1. I know for a fact that the pax is set correctly with position attitude because my objects are being placed on my terrain, which is georeferenced terrain, correctly; i.e. they are perpendicular w/ the terrain and sit nicely on it. 2. the above code snippet actually works for rotation about the local Z axis and I am looking straight down at my terrain; i.e. directly down the local Z axis. 3. I want to rotate the camera up 90 degrees and be looking down the positive X axis. 4. I have tried replacing qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), objectLocaction); with qRotAboutAxisByDegree.makeRotate( osg::DegreesToRadians(-90.), x_axis); and I get the camera rotated about some axis I am NOT sure of and I am looking at the terrain from a peculiar angle, though I know not what angle. 5. I am using the TerrainManipulator as my scene matrix manipulator, if that helps. Would someone please give me insight as to how to do this? I would be greatly appreciative as the solution is totally eluding me. :O ... Thank you! Thank you very much. Cheers, Allen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25471#25471 ___ osg-users mailing list osg-users@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. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org