About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Determination of the angle of rotation matrices
Author Message
Babulesnik Offline
Member

Post: #1
Determination of the angle of rotation matrices
I need to transfer over the network angles on the axes x, y, z.

If I turn the matrix along the x axis and check the result
Code:
ItemsBowling[4].matrix(ItemsBowling[4].matrix().setRotateX(PI_4));
...
D.text(0,0,S+ItemsBowling.absElm(4).matrix().angles().x);
The result is correct = 0.785

But if you increment the degree
Code:
ItemsBowling[4].matrix(ItemsBowling[4].matrix().setRotateX(PI));

I get a strange result = -0.000

How to find the angles of rotation matrix ?
01-04-2012 08:50 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #2
RE: Determination of the angle of rotation matrices
If I use the
Code:
ItemsBowling.absElm(4).matrix().axisAngle(ItemsBowling.absElm(4).matrix().orn().​x)
result to 180 degrees the angle is correct, if the angle is greater than 180 degrees countdown(

for example:
ItemsBowling[4].matrix(ItemsBowling[4].matrix().setRotateX(PI));
result = 3.142 - good !

ItemsBowling[4].matrix(ItemsBowling[4].matrix().setRotateX(PI+PI_6));
result = 2.618 - badly ((
01-06-2012 07:40 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
RE: Determination of the angle of rotation matrices
That's the nature of Matrices. I'm sure the reason for this is somewhere on this page.

You should probably just keep a Flt for storing the angle, so it doesn't countdown and you can go beyond -PI_2 to +PI_2 range.

Quaternions may be another option.

I may try to elaborate further later, but I gotta go right now.
(This post was last modified: 01-07-2012 01:22 AM by Driklyn.)
01-07-2012 01:21 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #4
RE: Determination of the angle of rotation matrices
When I get the angles ItemsBowling [1]
Code:
Vec angles = ItemsBowling[1].matrix().angles();

And turn the ItemsBowling [2] on these corners, I get an incorrect turn
Code:
ItemsBowling[2].matrix(ItemsBowling[2].matrix().rotateXY(angles.x,angles.y).rotateZ(angles.z));

Here is the code for the example
Code:
if(Kb.bp(KB_R))
      {
          static Flt x;
          x+=0.1;
          ItemsBowling[1].matrix(ItemsBowling[1].matrix().setRotateX(x));
          Vec angles = ItemsBowling[1].matrix().angles();

          Vec pos = ItemsBowling[2].pos();
          ItemsBowling[2].matrix(ItemsBowling[2].matrix().rotateXY(angles.x,angles.y).rotateZ(angles.z));
          ItemsBowling[2].pos(pos);

How to rotate an object at the angles x,y,z of another object? I need to pass these values ​​on the network.
(This post was last modified: 01-26-2012 05:39 PM by Babulesnik.)
01-26-2012 05:37 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: Determination of the angle of rotation matrices
Please,anyone help me solve this problem
01-28-2012 12:39 PM
Find all posts by this user Quote this message in a reply
Post Reply