Re: [osg-users] transformation matrix explanation
Hi, I would like to thank you for your answers. Especially for the website Skylark , it really got me started on the subject. I will definitely search more info on the 4x4 matrix. Now about the distances I admit that I wasn't clear :). I need the distance from the camera to the center of a given 3d model(OSG Node). For the position of the 3D model I would like to use the function getTransformationMatrix() of the node. Is it possible to use getTransformationMatrix on the camera node? Then I would use the method that Skylark suggested and my problem will be solved. As for scale, as far as I know my models are not scaled in runtime. Thank you for your time!! Stefanos Cheers, Stefanos -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44190#44190 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transformation matrix explanation
On 12/2/2011 6:09 AM, Stefanos Kougiou wrote: Hi, I would like to thank you for your answers. Especially for the website Skylark , it really got me started on the subject. I will definitely search more info on the 4x4 matrix. Now about the distances I admit that I wasn't clear :). I need the distance from the camera to the center of a given 3d model(OSG Node). For the position of the 3D model I would like to use the function getTransformationMatrix() of the node. Is it possible to use getTransformationMatrix on the camera node? Then I would use the method that Skylark suggested and my problem will be solved. As for scale, as far as I know my models are not scaled in runtime. If you multiply the object center by the camera's modelview matrix, the length of the resulting eye space vector is the distance. I strongly encourage you to learn OpenGL. Get the OpenGL Programming Guide. Older copies are available online for free, and they cover topics such as these. -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] transformation matrix explanation
Hello to all, I know that this is sort of a newbie question but i need to clear this one out. I have these two matrice Object near the camera: 0.00581384 -0.997389 -0.0719816 0 0.99705 0.0112907 -0.0759159 0 0.0765305 -0.0713279 0.994513 0 -10.7682 9.27382 -316.446 1 Object far from camera 0.0419087 -0.965536 0.256872 0 0.99876 0.0473957 0.0152043 0 -0.026855 0.255917 0.966326 0 -10.7372 31.5448 -722.176 1 I am trying to find some documentation about these 4x4 but everything confuses me more and more. Please is there -anywhere- an explanation of these? is it like I describe below? x y z ? transform 0.00581384-0.997389 -0.0719816 0 translate 0.99705 0.0112907 -0.0759159 0 rotate 0.0765305 -0.0713279 0.994513 0 projection -10.7682 9.27382 -316.446 1 The thing is that I need to compute a distance using these two matrice. Is possible by using these numbers? Thank you for your time Cheers, Stefanos -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44144#44144 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transformation matrix explanation
On 11/30/2011 1:37 PM, Jean-Sébastien Guay wrote: Distance from one object to the other? Simply subtract the translation of each matrix, which gives you the vector from one to the other. Then take the length of that. In OSG, you would do: osg::Vec3 o1_to_o2 = o1Matrix.getTrans() - o2Matrix.getTrans(); double distance = o1_to_o2.length(); That works when there's no scaling, and that appears to be the case in the OP's matrices. When scaling is used, it's possible for the translation values to be scaled (depending on order of matrix concatenation). One way to account for that would be to multiply the same vector by both matrices, subtract one result from the other, then get the length of the difference vector. But it really depends on what the OP wants. Does he want the distance from the transformed model origin of the two objects? Does he want the distance from the exterior of one bounding sphere to another? Does he want an exact closest distance accounting for possibly concave objects? Just a few different ways to interpret I need to compute a distance, in increasing order of complexity. :-) -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org