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 messages.emplace_back(
50 std::format(
"{}: Cannot find a Body in 'bodies' in the source model (or it isn't a Body)", get_bodies(i))
61 const OpenSim::Model& sourceModel,
62 OpenSim::Model& resultModel)
const final
68 for (
int i = 0; i < getProperty_bodies().size(); ++i) {
71 const auto* sourceBody = FindComponent<OpenSim::Body>(sourceModel, get_bodies(i));
75 const auto* resultBody = FindComponent<OpenSim::Body>(resultModel, get_bodies(i));
83 sourceBody->get_mass_center(),
84 resultBody->get_mass_center(),
87 *commonParams.sourceLandmarksFrame,
88 *commonParams.resultLandmarksFrame,
89 commonParams.tpsInputs,
90 commonParams.compensateForFrameChanges
94 auto* resultBodyMut = FindComponentMut<OpenSim::Body>(resultModel, get_bodies(i));
95 OSC_ASSERT_ALWAYS(resultBodyMut &&
"could not find a corresponding body in the result model");
96 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:83
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:72