Index: src/frames.hpp =================================================================== --- src/frames.hpp (revision 29858) +++ src/frames.hpp (working copy) @@ -387,6 +387,9 @@ //! (-PI <= alfa <= PI) void GetEulerZYZ(double& alfa,double& beta,double& gamma) const; + //! Sets the value of this object to a rotation specified with Quaternion convention + //! the norm of (x,y,z,w) should be equal to 1 + static Rotation Quaternion(double x,double y,double z, double w); //! Sets the value of this object to a rotation specified with RPY convention: //! first rotate around X with roll, then around the Index: src/frames.cpp =================================================================== --- src/frames.cpp (revision 29858) +++ src/frames.cpp (working copy) @@ -178,6 +178,14 @@ } +Rotation Rotation::Quaternion(double x,double y,double z, double w) +{ + double x2, y2, z2, w2; + x2 = x*x; y2 = y*y; z2 = z*z; w2 = w*w; + return Rotation(w2+x2-y2-z2, 2*x*y-2*w*z, 2*x*z+2*w*y, + 2*x*y+2*w*z, w2-x2+y2-z2, 2*y*z-2*w*x, + 2*x*z-2*w*y, 2*y*z+2*w*x, w2-x2-y2+z2); +} Rotation Rotation::RPY(double roll,double pitch,double yaw) {