Thread: Visualizing 3D rotation using quaternion data

  1. #1
    Registered User
    Join Date
    Jun 2014

    Visualizing 3D rotation using quaternion data

    Hi all,

    Just bought a new ST Micro iNEMO-M1 system, and am looking to have my code visually show me the rotation information. I've got a working C++ code which actively acquires data from the sensor, and I'm looking to extend that into some visual interface which will show me on-screen the position of the sensor.

    I figure using rotation information in the form of quaternion data is the most helpful (want to avoid the gimbal lock problems associated with Roll/Pitch/Yaw).

    I wanted to know if you all had any suggestions about how to get started--what would be the best method to visualize the rotation of my sensor in real-time?


  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Not sure what problem you're trying to solve here.
    I tried to do something similar a few months ago (using an accelerometer).

    I think your easiest path would be to use a library like glm apply the quaternion transformations on ..say a cube.
    You can then render the cube anyway you like.
    (AFAIK, implementing quaternion maths yourself on the gpu ( glsl) isn't really recommended)

  3. #3
    Registered User
    Join Date
    Jun 2014
    Exactly, basically just trying to get real-time feedback as to the sensor's position--so in theory a cube (or some other object--doesn't really matter) would rotate on screen matching the 3D rotation of the sensor as I rotate it in my hand.

    The system outputs gyroscope, accelerometer, and magnetometer data, and the MCU uses an extended Kalman filter algorithm to convert that to Roll/Pitch/Yaw as well as quaternion data, all of which I have easy access to. Just trying to figure out the most efficient way to utilize that data to visually display the cube's 3D orientation.

    The math involving quaternions definitely gets a little heavy--but it seemed like the most accurate method since it avoids that gimbal lock problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. quaternion rotation issues
    By Gadersd in forum Game Programming
    Replies: 6
    Last Post: 01-17-2013, 02:25 PM
  2. Vertice(s) location after quaternion Rotation
    By dgubser in forum C# Programming
    Replies: 8
    Last Post: 09-05-2012, 05:10 PM
  3. Replies: 3
    Last Post: 11-14-2011, 07:04 PM
  4. Expressing a quaternion with zero rotation
    By shrink_tubing in forum C++ Programming
    Replies: 12
    Last Post: 08-18-2010, 03:44 AM
  5. Quaternion Rotation
    By psychopath in forum Game Programming
    Replies: 16
    Last Post: 07-23-2006, 03:28 PM