Login
Username:

Password:


Lost Password?

Register now!
Main Menu
H3D.org Feeds
H3D.org Forum Index
   Programming Issues
     matrix transformation in cpp
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
xhanley
Posted on: 2009/12/2 16:06
Quite a regular
Joined: 2009/7/24
From:
Posts: 22
matrix transformation in cpp
Hi,

We are trying to map the transfromation (translation and rotation) of a Phantom premium to an object in the scene. However this is not meant to be a direct mapping but one that relates the position of a plane going though the device to that of a viewpoint. That is it is to have the object being transformed as a function of the movement of the haptics device.

When I use myTransform->matrix->getValue() it returns a 4x4. When I myTransform->matrix->getTypeName() it returns a SFMatrix4f. I want to use this data to set a matrix of the object im trying to transform. Any advice on this or similar code?
Markus
Posted on: 2009/12/4 8:36
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1532
Re: matrix transformation in cpp
I do not really understand what your question is exactly.

When you do the getValue on a field you get the contained value, that is the part of the field name without S/MF. So a SFMatrix4f contains a Matrix4f, SFVec3f contains a Vec3f. Use the value you get from getValue to set your matrix. Note the order of the indicies. If I remember correctly one row of a Matrix4f corresponds to one column of OpenGL matrices (transpose).

You could create your specialized autoupdate field and route the matrix field to your field in order to get an update whenever the matrix changes.
xhanley
Posted on: 2010/1/6 14:39
Quite a regular
Joined: 2009/7/24
From:
Posts: 22
Re: matrix transformation in cpp
Thanks for the reply. In the mean time we had taken a more direct route involving texture mapping which avoided these complications. I only now saw your response.


----------------
Donnchadh Oh-Ainle (NDRC)

Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 



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