Hello Reimar,

[EMAIL PROTECTED] wrote:
> Hi,
> 
> I try to get the world coordinates of an object, but I fail.
> I am using the following code:
> 
> 
> Matrix planeMatrix;
> transNode->getToWorld(planeMatrix);
> Pnt3f planeCenter;
> // local origin
> planeCenter[0] = 0;
> planeCenter[1] = 0;
> planeCenter[2] = 0;
> Vec3f planeCenterW;
> planeMatrix.multMatrixVec(planeCenter, planeCenterW);
> 
> Unfortunately planeCenterW = (0,0,0), which AFAIK it should not as 
> planeMatrix =
> 1.0  0.0  0.0  2.8
> 0.0 -1.0  0.0 13.1
> 0.0  0.0 -1.0  0.0
> 0.0  0.0  0.0  1.0
> 
> What am I doing wrong and how do I get the world coordinates of the local 
> origin
> of my object.

you need to use a Pnt3f instead of Vec3f and the corresponding 
multiplication function. Vectors are translation invariant in OpenSG and 
therefore the matrix does not affect planeCenterW.

        Hope it helps,
                Carsten

PS: You might want to take a look at this section 
<http://opensg.vrsource.org/trac/wiki/Tutorial/OpenSG1/Basics#TheMathStuff> 
of the tutorial.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to