Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Radian angle to Quaternion

Radian angle to Quaternion

Scheduled Pinned Locked Moved Algorithms
algorithms
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shaibee
    wrote on last edited by
    #1

    Hi, I have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation. Regards, Shoaib

    Its never over !

    7 1 Reply Last reply
    0
    • S shaibee

      Hi, I have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation. Regards, Shoaib

      Its never over !

      7 Offline
      7 Offline
      73Zeppelin
      wrote on last edited by
      #2

      shaibee wrote:

      have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation.

      You want to convert an axis angle, for example? A rotation around an axis in space can be converted to a quaternion Q(w,x,y,z). If the rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians, then the conversion is: w = cos(theta/2) x = ax * sin(theta/2) y = ay * sin(theta/2) z = az * sin(theta/2) Make sure the axis is normalized before conversion. If there is no rotation, the quaternion is the rotation identity quaternion.

      S 1 Reply Last reply
      0
      • 7 73Zeppelin

        shaibee wrote:

        have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation.

        You want to convert an axis angle, for example? A rotation around an axis in space can be converted to a quaternion Q(w,x,y,z). If the rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians, then the conversion is: w = cos(theta/2) x = ax * sin(theta/2) y = ay * sin(theta/2) z = az * sin(theta/2) Make sure the axis is normalized before conversion. If there is no rotation, the quaternion is the rotation identity quaternion.

        S Offline
        S Offline
        shaibee
        wrote on last edited by
        #3

        73Zeppelin wrote:

        rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians

        I believe I have theta, but I dont see any vector provided along with in the information object that I have. All it says is "angle in radians rotated from +ve world x-axis". Does this indicate any default vector that I can use for this conversion?

        Its never over !

        7 1 Reply Last reply
        0
        • S shaibee

          73Zeppelin wrote:

          rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians

          I believe I have theta, but I dont see any vector provided along with in the information object that I have. All it says is "angle in radians rotated from +ve world x-axis". Does this indicate any default vector that I can use for this conversion?

          Its never over !

          7 Offline
          7 Offline
          73Zeppelin
          wrote on last edited by
          #4

          So it's a rotation about the x-axis? This means the rotations around the other axes can be taken as zero. So your rotation vector would be: (ax, ay, az) = (theta, 0, 0) Don't forget to convert to a unit vector[^] if necessary.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups