Is there a ready function or method in Eigen for the Hat operator? That is the operator, taking a vector as input and returning a matrix, which mimics a cross product with that vector. I know, that it can be easily written, but would like to avoid it:
Eigen::Vector3d t = // some vector ;
Eigen::Matrix3d t_hat;
t_hat << 0, -t(2), t(1),
t(2), 0, -t(0),
-t(1), t(0), 0;
As you noted both cross and the cross3 methods actually perform the multiplication. But you want to make the skew-symmetric matrix representation of t
.
What you have seems like the best you can do for Vector3d
and Matrix3d
. Generalizing for various types of t
will require more time than I have right now, but it is an interesting question, so I may investigate later.