Author Topic: Problem with Rotation Matrices and Axes  (Read 1469 times)

Offline Jarz

  • byte
  • *
  • Posts: 1
    • View Profile
Problem with Rotation Matrices and Axes
« on: October 13, 2014, 11:03:49 am »
Hello,

I'm currently coding an Android App, it's my first time with JPCT. I have a very simple scenario, the 3D model of an IMU sensor and I want to rotate it with the rotation matrix that the sensor gives to me.

Ok, my problem is that the reference axes are always the same. This is, when I rotate the sensor around it's X axis (e.g.) the model rotates around the JPCT X Axis (Logically). But in order to get a good representation I need to rotate around my own X Axis. I've Read something about parent and child rotation, can I use this to apply a rotation over different axes each time? or there is another solution?

EDIT: I will try to explain it better,

Imagine this scenario, I have my sensor completely horizontal with the X axis pointing to right, Y positive is vertical (points up), and Z points to the front.

Mi model representation looks exacly the same.

Now I rotate the z axis of the  sensor 90º, so the X axis now is vertical. I want to get the X axis of the app vertical too!  instead of the original one of jpct. Because if now I rotate one more time over a different axis, the representation won't be real.

Sorry for my english and thank you so much!
« Last Edit: October 13, 2014, 12:04:02 pm by Jarz »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Problem with Rotation Matrices and Axes
« Reply #1 on: October 13, 2014, 08:52:09 pm »
Not sure what you mean exactly, but maybe this helps: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#rotateAxis(com.threed.jpct.SimpleVector, float)? As "axis", you can use the result of for example http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#getXAxis(). Is that what you meant?