reject method

V3 reject(
  1. V3 o
)

Rejects o from this vector.

Returns the component of this vector that is perpendicular to o. Complement of project: project(o).add(reject(o)) == this.

Implementation

V3 reject(V3 o) {
  final v1dv2 = (x*o.x + y*o.y + z*o.z);
  final v2dv2 = (o.x*o.x + o.y*o.y + o.z*o.z);
  final mag = v1dv2/v2dv2;
  return _v3(
    x - (o.x*mag),
    y - (o.y*mag),
    z - (o.z*mag),
  );
}