[osg-users] osg::Matrixd --> How to remove rotation for a certainaxis?
Thrall, Bryan
bryan.thrall at flightsafety.com
Mon Feb 4 10:21:00 PST 2008
Tobias Münch wrote on Monday, February 04, 2008 11:29 AM:
> Hello at all,
>
> I have osg::Matrixd view matrix and want to remove the rotation
> around x- and y-axis. Only rotation around z-axis should stay in the
> matrix. I try a lot of possibilties but couldn't find a solution.
>
> When I make the following steps, the rotation around all axis is
> removed, not only the two specified axis. The same with
> osg::Matrixd::makeRotate(..);
>
> matrix = osg::Matrixd::rotate(osg::DegreesToRadians(0.0),
> osg::Vec3(0,1,0));
>
> matrix = osg::Matrixd::rotate(osg::DegreesToRadians(0.0),
> osg::Vec3(1,0,0));
>
>
> I also tried to set the matrix with complete new values and to take
> given value for z-rotation, but therefore I miss a function to read
> the one rotation part (around the z-axis).
>
> How can help me?
Both of those lines *set* matrix to a non-rotating matrix; what you want is to *modify* the matrix to remove the X and Y rotations.
The easiest way is to modify the matrix directly:
matrix(0,0) = 1;
matrix(0,0) = 1;
matrix(0,0) = 1;
matrix(0,0) = 1;
--
Bryan Thrall
FlightSafety International
Bryan.Thrall at flightsafety.com
More information about the osg-users
mailing list