42 const OpenSim::Model& sourceModel)
const final
48 for (
int i = 0; i < getProperty_offset_frames().size(); ++i) {
49 const auto* offsetFrame = FindComponent<OpenSim::PhysicalOffsetFrame>(sourceModel, get_offset_frames(i));
50 if (not offsetFrame) {
51 messages.emplace_back(
53 std::format(
"{}: Cannot find a `PhysicalOffsetFrame` in 'offset_frames' in the source model (or it isn't a `PhysicalOffsetFrame`).", get_offset_frames(i))
64 const OpenSim::Model& sourceModel,
65 OpenSim::Model& resultModel)
const final
71 for (
int i = 0; i < getProperty_offset_frames().size(); ++i) {
72 const auto* sourceOffsetFrame = FindComponent<OpenSim::PhysicalOffsetFrame>(sourceModel, get_offset_frames(i));
73 OSC_ASSERT_ALWAYS(sourceOffsetFrame &&
"could not find a `PhysicalOffsetFrame` in the source model");
76 const auto* resultOffsetFrame = FindComponent<OpenSim::PhysicalOffsetFrame>(resultModel, get_offset_frames(i));
77 OSC_ASSERT_ALWAYS(resultOffsetFrame &&
"could not find a `PhysicalOffsetFrame` in the model");
79 const SimTK::Vec3 warpedLocation = scalingCache.lookupTPSWarpedRigidPoint(
82 sourceOffsetFrame->get_translation(),
83 resultOffsetFrame->get_translation(),
84 sourceOffsetFrame->getParentFrame(),
85 resultOffsetFrame->getParentFrame(),
86 *commonParams.sourceLandmarksFrame,
87 *commonParams.resultLandmarksFrame,
88 commonParams.tpsInputs,
89 commonParams.compensateForFrameChanges
92 auto* resultOffsetFrameMut = FindComponentMut<OpenSim::PhysicalOffsetFrame>(resultModel, get_offset_frames(i));
93 OSC_ASSERT_ALWAYS(resultOffsetFrameMut &&
"could not find a corresponding `PhysicalOffsetFrame` in the result model");
94 resultOffsetFrameMut->set_translation(warpedLocation);