Skip to content

Documentation / @interstellar-tools/equations / cross

Function: cross() ​

ts
function cross(a: Vector3DTupleType, b: Vector3DTupleType): Vector3DTupleType;

Defined in: helpers/misc.ts:106

Compute the cross product of two 3D vectors.

a×b=(aybz−azbyazbx−axbzaxby−aybx)

Parameters ​

ParameterTypeDescription
aVector3DTupleTypeFirst vector.
bVector3DTupleTypeSecond vector.

Returns ​

Vector3DTupleType

Cross product, perpendicular to both (units: product of the input component units).

Example ​

ts
cross([1, 0, 0], [0, 1, 0]); // [0, 0, 1]