Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6007391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:40:27+00:00 2026-05-23T01:40:27+00:00

I’m trying to understand how the quaternion rotations work, I found this mini tutorial

  • 0

I’m trying to understand how the quaternion rotations work, I found this mini tutorial http://www.julapy.com/blog/2008/12/22/quaternion-rotation/ but He makes some assumptions that I can’t workout, like how can I do “work out the rotation vectors around each axis, simply by rotating the vector around an axis.” and how does he calculate angleDegreesX, angleDegreesY and angleDegreesZ?

Can some one provide a working example or explanation?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:40:28+00:00Added an answer on May 23, 2026 at 1:40 am

    The shortest possible summary is that a quaternion is just shorthand for a rotation matrix. Whereas a 4×4 matrix requires 16 individual values, a quaternion can represent the exact same rotation in 4.

    For the mathematically inclined, I am fully aware that the above is super over-simplified.

    To provide a little more detail, let’s refer to the Wikipedia article:

    Unit quaternions provide a convenient
    mathematical notation for representing
    orientations and rotations of objects
    in three dimensions. Compared to Euler
    angles they are simpler to compose and
    avoid the problem of gimbal lock.
    Compared to rotation matrices they are
    more numerically stable and may be
    more efficient

    What isn’t clear from that opening paragraph is that a quaternion is not only convenient, it’s unique. If you have a particular orientation of an object, twisting on any number of axes, there exists a single unique quaternion that represents that orientation.

    Again, for the mathematically inclined, my uniqueness comment above assumes right-handed rotations. There is an equivalent left-handed quaternion that rotates in the opposite direction around the opposite axis.

    For the purpose of simple explanation, that is something of a distinction without a difference.

    If you’d like to make a simple quaternion that represents rotation about an axis, here’s a short series of steps that will get you there:

    1. Pick your axis of rotation v = {x, y, z}. Just for politeness, please pick a unit vector: if it’s not already of length 1, divide all the components by the length of v.
    2. Pick an angle of rotation that you’d like to turn about this axis and call that theta.
    3. The equivalent unit quaternion can be computed using the sample code below:

    Quaternion construction:

    q = { cos(theta/2.0),     // This is the angle component 
          sin(theta/2.0) * x, // Remember, angle is in radians, not degrees!
          sin(theta/2.0) * y, // These capture the axis of rotation
          sin(theta/2.0) * z};
    

    Note those divisions by two: those ensure that there’s no confusion in the rotation. With a normal rotation matrix, rotating to the right 90 degrees is the same as rotating to the left by 270. The quaternions that are equivalent to those two rotations are distinct: you can’t confuse one with the other.

    EDIT: responding to the question in the comments:

    Let’s simplify the problem by setting the following frame of reference:

    1. Pick the center of the screen as the origin (we’re going to rotate around that).
    2. X axis points to the right
    3. Y axis points up (top of the screen)
    4. Z axis points out of the screen at your face (forming a nice right handed coordinate system).

    So, if we have an example object (say an arrow) that starts by pointing to the right (positive x axis). If we move the mouse up from the x axis, the mouse will provide us with a positive x and positive y. So, working through the series of steps:

    double theta = Math.atan2(y, x);
    // Remember, Z axis = {0, 0, 1};
    // pseudo code for the quaternion:
    q = { cos(theta/2.0),     // This is the angle component 
          sin(theta/2.0) * 0, // As you can see, the zero components are ignored
          sin(theta/2.0) * 0, // Left them in for clarity.
          sin(theta/2.0) * 1.0};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.