Decompose vsg::dmat4 back into HPR #1598
-
|
I am using VSG with a coordinate system that is +X right, +Y forward, and +Z up. I have noticed that when I set the matrix for a vsg::Matrix transform, if I use M = H * P * R, then the order VSG does is left to right - Heading, then relative Pitch from there, then relative Roll from there. Once I've composed my vsg::dmat4 using this method, at some point later after it may have changed slightly, I'd like to decompose back into H, P, R for display purposes to the USER. I realize that a single vsg::dmat4 could map to more than one HPR, but that's OK, I'll take any reasonable one. But whichever way the HPR are calculated for a vsg::dmat4 M, the HPR values returned should work so that if I multiple H * P * R back I get the same original M. I've tried researching this and I have yet to find a reliable way to do this. Anyone using intrinsic Euler angles (compounded, not world based)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
There is a vsg::decompose() function that gets the translation, scale and rotation (as a vsg::quart),. but there isn't a vsg::decompose() for Heading, Pitch & Roll. I've never searched for a decompose to Heading, Pitch and Roll, nor thought about the topic, as I haven't yet found a need in the OSG and VSG projects. Could you just not just use vsg::quart for rotation, or perhaps find a quaternion to HPR implementation to do what you need? |
Beta Was this translation helpful? Give feedback.
There is a vsg::decompose() function that gets the translation, scale and rotation (as a vsg::quart),. but there isn't a vsg::decompose() for Heading, Pitch & Roll.
I've never searched for a decompose to Heading, Pitch and Roll, nor thought about the topic, as I haven't yet found a need in the OSG and VSG projects.
Could you just not just use vsg::quart for rotation, or perhaps find a quaternion to HPR implementation to do what you need?