Re: [osg-users] [build] rotating a geometry?

2009-10-31 Thread Paul Martz
I'd advise you to take a look at the Quick Start Guide examples. There's 
an example that draws two cows and rotates one around its local axis via 
a callback.


Quick Start Guide examples:
http://osgqsg.googlecode.com

Quick Start Guide:
http://www.lulu.com/content/paperback-book/openscenegraph-quick-start-guide/767629

I hope that helps.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ 
+1 303 859 9466

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] rotating a geometry?

2009-10-31 Thread Andreas Goebel
Thomas Maier schrieb:
> Hi,
> it seemed that all translations/transformations are done with a PAT, but when 
> i rotate the PAT object which does not sit at position 0,0,0 of the 
> "world-coordinates", but it rotates around the world-coordinate-axis, but i 
> want to  rotate around a axis of the object itself?
>
> I tried code like the following, but it always turns around 
> "world-coordinate-axis".
>
> pos->set(rectangleTwoXForm->getPosition().x(), 
> rectangleTwoXForm->getPosition().y()+1, rectangleTwoXForm->getPosition().z());
>   
> //rectangleTwoXForm->getPosition().set(rectangleTwoXForm->getPosition().x(), 
> rectangleTwoXForm->getPosition().y(), rectangleTwoXForm->getPosition().z() );
>   
> rectangleTwoXForm->setAttitude(osg::Quat(osg::DegreesToRadians(i), *pos )  );
>
>   
Hi,

you´ll need to compose your transform: First do a translation that
brings your axis to the origin, then rotate, then translate back.

Regards,

Andreas
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] rotating a geometry?

2009-10-31 Thread Thomas Maier
Hi,
it seemed that all translations/transformations are done with a PAT, but when i 
rotate the PAT object which does not sit at position 0,0,0 of the 
"world-coordinates", but it rotates around the world-coordinate-axis, but i 
want to  rotate around a axis of the object itself?

I tried code like the following, but it always turns around 
"world-coordinate-axis".

pos->set(rectangleTwoXForm->getPosition().x(), 
rectangleTwoXForm->getPosition().y()+1, rectangleTwoXForm->getPosition().z());

//rectangleTwoXForm->getPosition().set(rectangleTwoXForm->getPosition().x(), 
rectangleTwoXForm->getPosition().y(), rectangleTwoXForm->getPosition().z() );

rectangleTwoXForm->setAttitude(osg::Quat(osg::DegreesToRadians(i), *pos )  );


could someone help me?

Thank you!

Cheers,
Thomas

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18987#18987





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] rotating a geometry?

2009-10-30 Thread Thomas Maier
Hi,

i can rotate an geometry when i  use
osg::PositionAttitudeTransform* rectangleTwoXForm =
new osg::PositionAttitudeTransform();

and add the geometry with
rectangleTwoXForm->addChild(rectangleGeode);

then i can rotate the rectangleTwoXForm with e.g.
rectangleTwoXForm->setAttitude(osg::Quat(osg::DegreesToRadians(-90.0), 
osg::Vec3(0,1,0) ) );


But i cannot do this (rotation) with the original geometry? theres no 
setAttitude() member func? 

i saw Quat class member func makeRotate, but i use Vec3 not e.g. Vec3d. i must 
check the difference of both. perhaps someone got a good example?


Thank you!

Cheers,
Thomas

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18956#18956





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [build] rotating a geometry?

2009-10-30 Thread Thomas Maier
Hi,

i build an L-shape-plate with a geode and a geometry, but it could also consist 
out of two plane-boxes, one box 90 degress folded up to the other. I get it to 
move around in the scene with setPosition() member function, but i wanna 
control the geometry, so that it e.g. rotates? How can i do that?

Thank you!

Cheers,
Thomas

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18954#18954





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org