Skip to main content

adjustMarkerPosition.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This is used as a built in function for JMP to adjust the position of
% markers in the model.
%
% (Model, string, number, string) -> ()
% Move the marker in the specified axis to the specified value.


function adjustMarkerPosition(model, ...
markerName, value, axis)
currentPosition = model.getMarkerSet().get(markerName).get_location();
if strcmp(axis, "x")
newPosition = org.opensim.modeling.Vec3(value, ...
currentPosition.get(1), currentPosition.get(2));
end
if strcmp(axis, "y")
newPosition = org.opensim.modeling.Vec3(currentPosition.get(0), ...
value, currentPosition.get(2));
end
if strcmp(axis, "z")
newPosition = org.opensim.modeling.Vec3(currentPosition.get(0), ...
currentPosition.get(1), value);
end
model.getMarkerSet().get(markerName).set_location(newPosition);
end