Calculates a cross product of the given vectors. Returns a scalar.

Type signature

([a, b]: [number, number], [c, d]: [number, number]) => number

Examples

cross([3, 5], [-1, 8]);
// ⇒ 29
Try in REPL
cross([3, 5], [-1, -8]);
// ⇒ -19
Try in REPL

Questions

  • How to compute a cross product of two vectors?
  • How to check on which side of a line a point is?

TypeScript sourceJavaScript source