Thank you, that was refreshing

On Mon, Dec 22, 2008 at 3:15 PM, J.P. Delport <[email protected]> wrote:
> Hi,
>
> hemanth korrapati wrote:
>>
>> Hi
>> I am expecting my code to first rotate the point along y-axis and then
>> rotate the resultant point across x-axis. but only the rotation along
>> z is happening but not along x.
>
> The order you are expecting and the order in the code might not match. Try
> swapping the order of multiplication. You can search the archives of pre vs
> post multiplication.
>
>>
>> but its happening when i use a code like this:
>> ---------------------------------------
>>        osg::Matrixd mat,mat1;
>>        mat.makeRotate(osg::DegreesToRadians(-45.0),osg::Vec3(.0,.0,1.0));
>>
>>  mat1.makeRotate(osg::DegreesToRadians(-45.0),osg::Vec3(1.0,.0,0.0));
>>        osg::Vec3 temp(2000,0.0,0.0);
>>        mat1=mat1*mat;
>>        temp=mat1*temp;
>> --------------------------------------------
>>
>> Is this an effecient way or are there some other ways ?
>>
>> Also to make the desired 45 deg rotation along z and x axes I am
>> giving -45 as argument as you can see from the above code. If I give
>> 45 deg then it is rotating in the clockwise direction. I am seeing the
>> output visually.
>
> The +/- swaps normally occur when the axis that you think you are rotating
> around is actually flipped.
>
>> Why does this happen ?
>
> It is quite easy to get rotations confused by either confusing the
> coordinate system the rotations are taking place in or confusing the
> rotation order. What can also confuse matters is if the coordinate system of
> the model and the coordinate system of the viewer does not match.
>
> Rotations can always be visualised from two viewpoints: 1) You are sitting
> in the object and the axis system is rotating with you. 2) You are external
> to the object and the rotations are being done in a fixed coordinate system.
>
> In code 1 and 2 are different in terms of the order that you specify the
> rotations in.
>
> jp
>
>>
>> Thank You
>>
>>
>>
>>
>> On Mon, Dec 22, 2008 at 2:42 PM, Vincent Bourdier
>> <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> It sound normal for me to have a y rotation for result.
>>> Make a little drawing, you will see that.
>>>
>>> Vincent.
>>>
>>> 2008/12/22 hemanth korrapati <[email protected]>
>>>>
>>>> hi all,
>>>>
>>>> I want to rotate a point which is on x-axis by 45 degrees w.r.t z-axis
>>>> and 45 degrees w.r.t x-axis. So I am using the following code
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>       osg::Matrixd mat;
>>>>
>>>>
>>>>  
>>>> mat.setRotate(osg::Quat(osg::DegreesToRadians(45.0),osg::Vec3d(.0,0.0,1.0))*osg::Quat(osg::DegreesToRadians(45.0),osg::Vec3d(1.0,0.0,0.0)));
>>>>       osg::Vec3 temp(2000,0.0,0.0);
>>>>       temp=mat*temp;
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>
>>>> After this I see that only the point is rotated across y-axis(i.e the
>>>> first rotation)  but not along x-axis. (only one rotation performed)
>>>> also it rotates in the negative direction.
>>>>
>>>> dows anyone know why these things happen ?
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> [email protected]
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> 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
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to