Page 1 of 1

Transform a point into a new frame

Posted: Fri Jan 31, 2025 1:49 am
by kernalnet
Hi,
I have a 3D point, and I want to express it wrt a new frame:
3D_space_point_frames.png
3D_space_point_frames.png (6.67 KiB) Viewed 191 times

I want to learn how to do it with OpenSim API. I can create two PhysicalOffsetFrame objects (one for the origin and one for the new frame), update their orientations (set_orientation) and translations (set_translation), and use findStationLocationInAnotherFrame. The problem is that this method requires State as argument, but I don't have any Model to call initSystem.

I also checked Transform class, but couldn't find any spevific method; perhaps the operators???

I wonder if this could be possible in OpenSim API without building a model. Any help would be greatly appreciated.

Re: Transform a point into a new frame

Posted: Sat Feb 01, 2025 1:04 pm
by kernalnet
***UPDATE***

Transform::shiftBaseStationToFrame did it. I'm posting the solution here:

Code: Select all

import opensim as osim

point = osim.Vec3(...)

rotMat = osim.Rotation()
rotMat.setRotationToBodyFixedXYZ( osim.Vec3(...) )
location = osim.Vec3(...)

transMat = osim.Transform(rotMat, location)
transMat.shiftBaseStationToFrame(point)