- This topic has 1 reply, 2 voices, and was last updated 8 years, 1 month 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] Modify origin and orientation of a mesh(oglModel) to be the same as another mesh
Tagged: 64_bits, Linux_other, SOFA_1608
Hello,
I am new to SOFA and I am having trouble with the position of the different meshes loaded in my scene. Particularly, I load two .stl meshes in two different nodes and then assign a Mechanical object (linking the position to the loader), and a OglModel, linking the geometry and position.
The problem is that, originally, the meshes are placed with different origins. What I want to do is place the two meshes together, with the same origin. However, I cannot find any variable that stores this, as the position refers to the positions of the dofs or nodes of the mesh.
Is there a origin variable so I can align the two meshes? also aligning their coordinates would be perfect.
Thank you very much,
Albert.
Hi Albert,
I do not think that an “origin position” is stored somewhere in a .stl file. So I do not know any easy way to have the relative position of your two meshes.
However, if you know the relative position of your two meshes, in the MechanicalObject component you can specify a translation of vector [x,y,z] (translation=”x y z”) and a rotation specified by the Euler angles (rotation=”phi theta psi”). SOFA will apply first the rotation around [0,0,0] and then the translation to all the points of the MechanicalObject. You can also specify the translation and the rotation directly inside your mesh loader component.
Just out of curiosity, how do you generate your .stl files and why aren’t them aligned by default?
Rosalie
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.