Page 1 of 1
Set dimension WrapEllipsoid whit Matlab
Posted: Wed Oct 10, 2018 1:23 am
by matteo.m
Hi all, I want to set the dimensions of a WrapEllipsoid whit Matlab, I saw the methods and found this: getDimensionsString() whit return type java.lang.String. But I can't give it the input string, any suggestions?
Thanks for your answers!
Re: Set dimension WrapEllipsoid whit Matlab
Posted: Wed Oct 10, 2018 7:30 am
by tkuchida
A similar question was recently asked and answered here (topic 9584):
viewtopicPhpbb.php?f=91&t=9584.
Re: Set dimension WrapEllipsoid whit Matlab
Posted: Wed Oct 10, 2018 9:28 am
by matteo.m
Hi,I know these methods for the Wrapcylinder but they don't work for a WrapEllipsoid.
Re: Set dimension WrapEllipsoid whit Matlab
Posted: Wed Oct 10, 2018 12:11 pm
by tkuchida
Ah, good point. The
getRadii() method (in the WrapEllipsoid class) returns a Vec3 as expected, but there's no corresponding
setRadii() method. However, this strategy seems to work:
Code: Select all
% OpenSim 4.0
import org.opensim.modeling.*
model = Model('arm26.osim');
humerus = model.getBodySet().get('r_humerus');
wrapEllipsoid = WrapEllipsoid.safeDownCast( humerus.getWrapObject('TRIlonghh') );
fprintf('Original radii: %s\n', char(wrapEllipsoid.getRadii()));
prop = wrapEllipsoid.updPropertyByName('dimensions');
PropertyHelper.setValueDouble(1.1, prop, 0);
PropertyHelper.setValueDouble(2.22, prop, 1);
PropertyHelper.setValueDouble(3.333, prop, 2);
fprintf('New radii: %s\n', char(wrapEllipsoid.getRadii()));
The following is displayed in the MATLAB Command Window:
Code: Select all
Original radii: ~[0.035,0.02,0.02]
New radii: ~[1.1,2.22,3.333]
Re: Set dimension WrapEllipsoid whit Matlab
Posted: Thu Oct 11, 2018 12:47 am
by matteo.m
Ok, it work! Thanks!