crossInto method

void crossInto(
  1. Vector3 other,
  2. Vector3 out
)

Write this × other into out without allocating. Safe when out is this or other.

Implementation

void crossInto(Vector3 other, Vector3 out) {
  final cx = y * other.z - z * other.y;
  final cy = z * other.x - x * other.z;
  final cz = x * other.y - y * other.x;
  out.x = cx;
  out.y = cy;
  out.z = cz;
}