Dear Robert, thank you for your reply, below is the code to reproduce the bug:
/********************************************************/ osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::Quat(0.1, 0.5, 0.6, 0.7)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout << mat.getScale().x() << " "<< mat.getScale().y() << mat.getScale().z() << std::endl;//Oops...seems wrong osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout << x_vec2.length() << " "<< y_vec2.length() << z_vec2.length() << std::endl; //seems correct /********************************************************/ If the matrix combination above makes sense, then I guess what I found is indeed a bug. Thank you for your time and work. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 11:36 AM, Robert Osfield <robert.osfi...@gmail.com>wrote: > Hi Tianlan, > > Could you provide a small example that illustrates the problem? > > I did a quick test of: > > osg::Matrixd matrix = osg::Matrixd::scale(3.0,4.0,1.0); > OSG_NOTICE<<"Matrixd.getScale() = "<<matrix.getScale()<<std::endl; > > And this works. I will need to have a think about a more complex > scale set up before I can judge what it should be. > > Robert. > > On 15 April 2014 16:43, Tianlan Shao <shaotianlan...@gmail.com> wrote: > > Dear all, > > The following code in the header file MatrixD looks very suspicious to > me: > > > > inline Vec3d getScale() const { > > Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); > > Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); > > Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); > > return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); > > } > > > > Shouldn't the index order be the other way around? I mean it should be > > > > inline Vec3d getScale() const { > > Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]); > > Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]); > > Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]); > > return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); > > } > > > > The behaviour of my program was strange before I fix this problem. I'm > not > > 100% percent sure, but since it's of fundamental importance, I still > decided > > to report. > > > > Best regards, > > Tianlan Shao > > > > > > _______________________________________________ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org