- This topic has 1 reply, 2 voices, and was last updated 8 years ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] On the rotation of a mesh model (OglModel)
Hello,
I am posting here regarding the different approaches to apply a rotation over a mesh (OglModel) that exist in SOFA.
Right now I have my node in the scene that has the property rotation = “90 0 0”, for example. What I want to do, though, is to rotate that mesh to face a given direction, let’s say (1,0,0). If initially the mesh is placed facing (0,1,0), computing the rotation that we have to apply to make the mesh face (1,0,0) is not that trivial in C++. What can be done is to extract the axis-angle representation (three coordinates of the axis of rotation, and a 4rth one with the amount of rotation). However, transitioning from that to the format of the rotation field (Euler Angles), is somewhat complex.
Are there any other methods or representations in SOFA for specifying rotations? for instance with an axis-angle representation, or quaternions, or even aligning a given axis of an object, in this case the mesh, to a given direction (as in Unity), or any method to compute a rotation to a given direction in a fast way.
Thank you,
Albert.
Hi @arcadiablur,
Did you succeed to do what you wanted?
At my best knowledge, rotation of mesh is only available using Euler angles. However, to edit your mesh and define the right orientation, this should be done before loading it into SOFA. This would be feasible in any mesh editor (Paraview or MeshLab for instance).
NOTE: In C++, you have the class Quater allowing for manipulating quaternions and the related Euler angle.
Best
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.