Cross product for vectors of size 2. Fixes #1037

This commit is contained in:
Gabriele Buondonno
2022-11-15 22:39:42 +00:00
committed by Antonio Sánchez
parent 8588d8c74b
commit 6431dfdb50
7 changed files with 108 additions and 34 deletions

View File

@@ -9,5 +9,10 @@ int main()
std::cout << "Dot product: " << v.dot(w) << std::endl;
double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
std::cout << "Dot product via a matrix product: " << dp << std::endl;
std::cout << "Cross product:\n" << v.cross(w) << std::endl;
Eigen::Vector2d v2(1,2);
Eigen::Vector2d w2(0,1);
double cp = v2.cross(w2); // returning a scalar between size-2 vectors
std::cout << "Cross product for 2D vectors: " << cp << std::endl;
}