Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Ross Wilkinson
- Posts: 1
- Joined: Fri May 20, 2016 5:58 pm
Post
by Ross Wilkinson » Tue Mar 02, 2021 1:26 pm
Hello,
Could you please tell me how to set the position (transform) of multiple geometry files within a body using the MATLAB API. I.e., I would like to set the transform of 'cerv1.vtp' mesh as [0 0 0 0.0216 0.1179 0].
Code: Select all
head = Body('head', headMass, Vec3(0), Inertia(1));
head.attachGeometry(Mesh('skull.vtp'));
head.attachGeometry(Mesh('jaw.vtp'));
head.attachGeometry(Mesh('cerv1.vtp'));
head.attachGeometry(Mesh('cerv2.vtp'));
head.attachGeometry(Mesh('cerv3.vtp'));
head.attachGeometry(Mesh('cerv4.vtp'));
head.attachGeometry(Mesh('cerv5.vtp'));
head.attachGeometry(Mesh('cerv6.vtp'));
head.attachGeometry(Mesh('cerv7.vtp'));
model.addBody(head);
Any help is appreciated.
Thanks in advance,
Ross
Tags:
-
Rory Turnbull
- Posts: 28
- Joined: Mon Dec 16, 2019 1:57 am
Post
by Rory Turnbull » Wed Mar 03, 2021 3:06 am
Geometry is just for visualisation so if you did add all the geometry to the same body it would be easier to merge them separately into the same .vtp or .stl file with the transformations you want, then add a single .vtp to the body.
If you are wanting movement between them and/or want to add them individually anyway, each geometry file would need its own body. Then when setting up the joints between bodies you can set the relative transformations.
Best wishes,
Rory
-
Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Post
by Ayman Habib » Thu Mar 04, 2021 2:47 pm
Thanks Rory,
The attachGeometry call assumes that there's no offset (Geometry/Mesh is attached to the specific Frame directly). If an offset is needed, you can create an OffsetFrame with a fixed offset from the Body and then call attachGeometry on this OffsetFrame. The offset is specified by a SimTK::Transform which can be made up from Translation and Rotation.
Hope this helps,
-Ayman