## cross products of vectors of dimensions other than 3

## Submitted by Michael

Assigned to **Nobody**

**Link to original bugzilla bug (#1037)**

**Version**: 3.4 (development)

## Description

I would like to request a cross product of 2D vectors.

Eigen defines cross product only for vectors of size 3; however, cross product is defined (although under a different name) for vectors of arbitrary equal sizes.

In particular, cross product of vectors of size 2 is very useful in computational geometry. The result should be a scalar equal to the signed area of a parallelepiped spanned by the input vectors. Or, to put it differently, cross product of (v1, v2) and (w1, w2) should be the 3rd coordinate of the cross product of (v1, v2, 0) and (w1, w2, 0).

In general, cross product of N dimensional vectors is a skew-symmetric NxN matrix with i,j-th entry equal, up to the sign, v[i]*w[j]-v[j]*w[i].

Since skew-symmetric 3x3 matrices have only 3 independent components (the ones above the diagonal), cross-product of 3D vectors is naturally represented as Vector3. If fact, most of literature that mentions cross-products bypasses the matrix definition and exposes only the 3D vector that naturally represents it.

Similarly, skew-symmetric 2x2 matrices have only 1 independent component; therefore the result could be treated as a scalar.

The computations that are naturally representable as cross products of 2D vectors occur very often in computing areas and intersections and integration. Therefore it would be useful if Eigen would implement Vector2.cross as was done for Vector3.cross.

I am not confident though whether implementing cross product in full generality, for vectors of arbitrary equal sizes, would be useful.