cross method

Vec3 cross(
  1. Vec3 vector, [
  2. Vec3? target
])

Vector cross product @param target Optional target to save in.

Implementation

Vec3 cross(Vec3 vector, [Vec3? target]){
  target ??= Vec3();
  final vx = vector.x;
  final vy = vector.y;
  final vz = vector.z;

  target.x = y * vz - z * vy;
  target.y = z * vx - x * vz;
  target.z = x * vy - y * vx;

  return target;
}