dimanche 24 avril 2016

Creating a matrix?

I am trying to create a rotation matrix using Eigen::Matrix3d, but can't seem to do it accurately..

void rot(double x,double y,double z)
{

    Eigen::Matrix3d x_r ((double)1,(double)0,(double)0,
                         (double)0,cos(x),-sin(x),
                         (double)0,sin(x),cos(x));

    Eigen::Matrix3d y_r (cos(y),(double)0,sin(y),
                        (double)0,(double)1,(double)0,
                         -sin(y),(double)0,cos(y));

    Eigen::Matrix3d z_r (cos(z),-sin(z),(double)0,
                         sin(z),cos(z),(double)0,
                         (double)0,(double)0,(double)1) ;

    Eigen::Matrix3d rot = z_r*y_r*x_r;

} 

I can't crate x_r,y_r,z_r for some weird reason?.. Could someone elaborate what i am doing wrong?

Error message i am receiving is:

error: no matching function for call to 'Eigen::Matrix<double, 3, 3>::Matrix(double, double, double, double, double, double, double, double, double)'

First i thought i was because i was using a combination of double and intwhich is why i typecasted it in the first place..

Aucun commentaire:

Enregistrer un commentaire