27 OpenSim_DECLARE_LIST_PROPERTY(bodies, std::string,
"Query paths (e.g. `/bodyset/*`) that the engine should use to find bodies in the source model that should be warped by this scaling step.");
33 setDescription(
"Warps the locations of body centers of mass in the model using the Thin-Plate Spline (TPS) warping algorithm.");
34 constructProperty_bodies();
40 const OpenSim::Model& sourceModel)
const final
46 for (
int i = 0; i < getProperty_bodies().size(); ++i) {
47 if (not FindComponent<OpenSim::Body>(sourceModel, get_bodies(i))) {
48 std::stringstream msg;
49 msg << get_bodies(i) <<
": Cannot find a Body in 'bodies' in the source model (or it isn't a Body)";
60 const OpenSim::Model& sourceModel,
61 OpenSim::Model& resultModel)
const final
67 for (
int i = 0; i < getProperty_bodies().size(); ++i) {
70 const auto* sourceBody = FindComponent<OpenSim::Body>(sourceModel, get_bodies(i));
74 const auto* resultBody = FindComponent<OpenSim::Body>(resultModel, get_bodies(i));
82 sourceBody->get_mass_center(),
83 resultBody->get_mass_center(),
86 *commonParams.sourceLandmarksFrame,
87 *commonParams.resultLandmarksFrame,
88 commonParams.tpsInputs,
89 commonParams.compensateForFrameChanges
93 auto* resultBodyMut = FindComponentMut<OpenSim::Body>(resultModel, get_bodies(i));
94 OSC_ASSERT_ALWAYS(resultBodyMut &&
"could not find a corresponding body in the result model");
95 resultBodyMut->set_mass_center(warpedLocation);
SimTK::Vec3 lookupTPSWarpedRigidPoint(const OpenSim::Model &sourceModel, const OpenSim::Model &resultModel, const SimTK::Vec3 &sourceLocation, const SimTK::Vec3 &resultLocation, const OpenSim::Frame &sourceParentFrame, const OpenSim::Frame &resultParentFrame, const OpenSim::Frame &sourceLandmarksFrame, const OpenSim::Frame &resultLandmarksFrame, const ThinPlateSplineCommonInputs &tpsInputs, bool compensateForFrameChanges)
Definition scaling_cache.h:82
virtual std::vector< ScalingStepValidationMessage > implValidate(ScalingCache &, const ScalingParameters &, const OpenSim::Model &) const
Definition scaling_step.h:92
virtual void implApplyScalingStep(ScalingCache &, const ScalingParameters &, const OpenSim::Model &, OpenSim::Model &) const
Definition scaling_step.h:103
Definition thin_plate_spline_body_center_of_mass_scaling_step.h:24
std::vector< ScalingStepValidationMessage > implValidate(ScalingCache &, const ScalingParameters &, const OpenSim::Model &sourceModel) const override
Definition thin_plate_spline_scaling_step.h:71