How to get the new points after rotating a geometry?
osg::ref_ptr<osg::Vec3Array> points = new osg::Vec3Array;
osg::ref_ptr<osg::Geometry> geometry( new osg::Geometry);
points->push_back(osg::Vec3(0.0,0.0,0.0));
points->push_back(osg::Vec3(10.0,10.0,0.0));
geometry ->setVertexArray(points.get());
geometry ->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0, points->size()));
cout<<points[0][1]; //returns the right values 10 10 0
MatrixTransform* transform = new osg::MatrixTransform;
const double angle = 0.8;
const Vec3d axis(0, 0, 1);
transform->setMatrix(Matrix::rotate(angle, axis));
transform->addChild(geometry);
I tried this:
Vec3Array *_line= dynamic_cast< osg::Vec3Array*>(transform->getChild(0)->asGeometry()->getVertexArray());
cout<<_line->back(); // it returns equal 10 10 0
But it returns the same coords before rotating, where are the new point values?