Math module

cross_product

procedure · 1 overloadSource

The cross product of two Vector3: perpendicular to both, with length |a||b|sin(angle), and zero when they are parallel. Right-handed: x cross y is z. Also spelled cross.

ExampleOpen in playground ↗
assert(cross(xyz(1, 0, 0), xyz(0, 1, 0)) == xyz(0, 0, 1));
assert(cross(xyz(0, 1, 0), xyz(1, 0, 0)) == xyz(0, 0, -1));
cross_product :: (a: Vector3, b: Vector3) -> Vector3

The cross product of a and b, perpendicular to both. Also available as cross.

Parameters

a: Vector3
the left vector.
b: Vector3
the right vector.

Returns

See also