vsub method

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

Vector subtraction @param target Optional target to save in.

Implementation

Vec3 vsub(Vec3 vector, [Vec3? target]){
  if (target != null) {
    target.x =  x-vector.x;
    target.y =  y-vector.y;
    target.z =  z-vector.z;
    return target;
  } else {
    return Vec3(x - vector.x, y - vector.y, z - vector.z);
  }
}