Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






extracting elements from a vec3f
#1
Just popping in
Just popping in


See User information
Hello everyone,

I'm very new to H3DAPI. Gone through most of the tutorials, but I can't figure out how to extract an element of a Vec3f vector.

For example, using H3D::H3DHapticsDevice Class Reference, there's a function called trackerVelocity. This data is in a SFVec3f format. I want to access the three Cartesian velocities separately and store them to a variable to further manipulate using regular python math operations.

Thank you very much to anyone willing to spare their time to help!

Regards,
EzraBiom

Posted on: 11/9 16:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: extracting elements from a vec3f
#2
Webmaster
Webmaster


See User information
In python or C++?
python code
#find the code in the manual to get an instance of the haptics device. Let us say you have done this and the haptics device is in a variable called hd. Then do the following
hd.trackerVelocity.getValue().x


It works the same way in C++ but with -> instead of . in some of the places due to it being pointers.
hd - The device instance as I pointed out above
trackerVelocity - Access to the field
getValue() - Get the value of the field. The value will be of type Vec3f()
x - The x component of the value of the field.

Posted on: 11/10 9:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: extracting elements from a vec3f
#3
Just popping in
Just popping in


See User information
Thank you very much! This is exactly what I was looking for!

Posted on: 11/10 15:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





(C) 2012 SenseGraphics AB    ---    Powered by XOOPS