Cross-product matrix in Eigen
Asked Answered
R

1

21

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;
Ruffina answered 1/10, 2014 at 8:2 Comment(1)
That matrix is usually called antisymmetric or skew-symmetric matrix.Upbuild
B
9

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.

Baeyer answered 20/4, 2015 at 17:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.