简体   繁体   中英

How to Rotate an object about its own axis?

I'm having a problem working out how to solve a problem.

My problem involves getting the 3D representation of an objects angle, and then applying a rotation to that object on it's own axis.

For example, an aircraft with:

  • Heading 45 (North East)
  • Pitch 45 (Nose Up)
  • Bank 45 (Banked Left)

That is rotated across it's own yaw axis through -90 degrees should then be roughly:

  • Heading ~-9.8 (North by North North West)
  • Pitch -30 (Nose Down)
  • Bank 54.5 (Banked Left)

(As calculated purely off guesstimation using another program to make the aircraft a child of itself and rotate through 90 degrees, then trying to match the orientation...)

Can anyone explain how this sort of rotation is calculated? or even point me into the right path as to learning how?

I have tried applying a basic rotation matrix to the angles (as to be used for rotating points about an origin), but it only rotates relative to the base x/y/z axes and not that of the aircraft (so results from above would be (-45,45,45)

For mathematics purposes, the rotation does not concern point co-ordinates, only the 3 representation angles.

I would prefer not to use any external libraries.

Though irrelevant, this will be for a C# application.

Thank you all very much for your help and insight!

The rotation matrix is a good start, but you'll need a Translation matrix as well to get the origin right.

You'll need linear algebra with rotation matrices if you want to do it by hand. It require some mathematics skills.

Basically this (below) states: move the object to the origin of x/y/z/, apply the rotation matrix and put it back at the original position.

I must warn you, it's hard to get it right by hand.

http://en.wikipedia.org/wiki/Translation_%28geometry%29

http://en.wikipedia.org/wiki/Rotation_matrix

As a acquaintance of mine put it once:

r'j(t) = r'0(t) + Ω(t) x [rj(t) - r0(t)]

http://en.wikipedia.org/wiki/Euler%27s_rotation_theorem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM