Set dimension WrapEllipsoid whit Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Matteo Musso
Posts: 12
Joined: Wed May 23, 2018 3:42 am

Set dimension WrapEllipsoid whit Matlab

Post by Matteo Musso » Wed Oct 10, 2018 1:23 am

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!

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Set dimension WrapEllipsoid whit Matlab

Post by Thomas Uchida » Wed Oct 10, 2018 7:30 am

A similar question was recently asked and answered here (topic 9584): viewtopicPhpbb.php?f=91&t=9584.

User avatar
Matteo Musso
Posts: 12
Joined: Wed May 23, 2018 3:42 am

Re: Set dimension WrapEllipsoid whit Matlab

Post by Matteo Musso » Wed Oct 10, 2018 9:28 am

Hi,I know these methods for the Wrapcylinder but they don't work for a WrapEllipsoid.
Attachments
Cattura.PNG
Cattura.PNG (78.1 KiB) Viewed 393 times

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Set dimension WrapEllipsoid whit Matlab

Post by Thomas Uchida » Wed Oct 10, 2018 12:11 pm

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]

User avatar
Matteo Musso
Posts: 12
Joined: Wed May 23, 2018 3:42 am

Re: Set dimension WrapEllipsoid whit Matlab

Post by Matteo Musso » Thu Oct 11, 2018 12:47 am

Ok, it work! Thanks!

POST REPLY