For what it's worth, we found that since all DOFTransforms (coming from
OpenFlight files) were in the same order, namely heading, roll, pitch (or
was it the other way around - I always have to go back to the maths to
remember) we saved a lot of time by implementing our own "replacement",
firstly with fixed axis order, and secondly along the lines of:
double sx = sin(roll);
double cx = cos(roll);
double sy = sin(pitch);
double cy = cos(pitch);
double sz = sin(yaw);
double cz = cos(yaw);
double sxsy = sx*sy;
double cxsy = cx*sy;
return osg::Matrix(
cy*cz, cy*sz, -sy, 0.0,
sxsy*cz-cx*sz, sxsy*sz+cx*cz, sx*cy, 0.0,
cxsy*cz+sx*sz, cxsy*sz-sx*cz, cx*cy, 0.0,
0.0, 0.0, 0.0, 1.0
);
as this also avoided the quaternion conversions embedded in DOFTransform's
use of
osg::Matrix::rotate(-getCurrentHPR()[0], 0.0, 0.0, 1.0)
We got a 2-4x reduction in time spend in DOFTransform, from profiling, so it
seemed like a good idea.
David
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/