Thanks! You are correct :-) On Mon, May 11, 2015 at 10:35 AM, Robert Osfield <[email protected]> wrote:
> Hi John, > > On 11 May 2015 at 09:26, John Ivar Haugland <[email protected]> > wrote: > > Regarding vector and matrix operations in OpenSceneGraph, I have > experienced > > (some years ago) loosing precision when using the following operation, > where > > _localToWorld is a osg::Matrixd > > > > osg::Vec3d v = vertices->at(i) * _localToWorld; > > > > To get the correct result I had to compute it in two steps: > > > > osg::Vec3d vert = vertices->at(i); > > osg::Vec3d v = vert * _localToWorld; > > > > I am not sure if this problem still exist with the current matrix and > vector > > classes. > > If you wanted double precision when you are passing in a float vector > then I don't think you should be expecting the compiler to know > automatically change it to double, or for the OSG to by default do > double maths even though you passed in float. The simple way is to > explicitly convert the Vec3f to a Vec4f, but no need for two steps: > > osg::Vec3d v = osg::Vec3d( vertices->at(i)) * _localToWorld; > > > Robert. > _______________________________________________ > osg-submissions mailing list > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org >
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
