Hi guys,

I'm new to osg... so bare with me

>From the MFC application i get two CPoint points and I try to do some 
>geometrical transformations.

I'm using osg::PositionAttitudeTransform in order to rotate, scale and 
translate a model.


Code:
osg::ref_ptr<osg::PositionAttitudeTransform> _pat = new 
osg::PositionAttitudeTransform();




and then I'm adding the model as a child to _pat.

What i do is to get the center weight point for the model and this:

Code:
_pat->setPivotPoint(centerWeightPoint);
_pat->setPosition(centerWeightPoint);




I've implemented the Scale:

Code:
osg::Vec3d scale = _pat->getScale();
osg::Vec3d actualScale = osg::Vec3d(scale.x() * scaleFactor,  scale.y() * 
scaleFactor,  scale.z() * scaleFactor);

_pat->setScale(actualScale);




the Translate (here the z is always 0 from input) :

Code:
osg::Vec3f translate = _pat->getPosition();
translate += osg::Vec3f(x, y, z);
_pat->setPosition(translate);




My problem is that scale and translate don't work very accurate.
The translation seems to be more than that (like it would apply a rotation too) 
and the scale kind of stretches my model in some directions more than in 
others. 

Is that something I'm missing? Do I have problems when i get from CPoint (2D) 
to my model which is 3D?

Thank you!

Cheers,
Andrei

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to