Hi Andrei, From your post I can't really determine exactly what is up. The best I can do is explain how the pivot and position point work. The PivotPoint is the position in local coordinate frame of the subgraph that want to position that you'll scale, and rotate around, and the Position is the final position that the PivotPoint will be placed at in the parents coordinate frame.
Robert. On Thu, Aug 27, 2009 at 10:11 AM, Андрей Чобану<[email protected]> wrote: > 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. > >Type name of new folder > 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 > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

