public static IVec3 Subtract(IVec3 first, params IVec3[] vecs) { if (vecs.Length == 0) { return(first); } IVec3 vec = first.GetNewInstance(first.X, first.Y, first.Z); for (int i = 0; i < vecs.Length; i++) { vec.X -= vecs[i].X; vec.Y -= vecs[i].Y; vec.Z -= vecs[i].Z; } return(vec); }
public static IVec3 Dot(IVec3 left, IVec3 right) { return(left.GetNewInstance(left.X * right.X, left.Y * right.Y, left.Z * right.Z)); }
public static IVec3 Normalized(IVec3 vec) { float dist = GetLength(vec); return(vec.GetNewInstance(vec.X / dist, vec.Y / dist, vec.Z / dist)); }
public static IVec3 Scale(IVec3 vec, IVec3 scalar) { return(vec.GetNewInstance(vec.X * scalar.X, vec.Y * scalar.Y, vec.Z * scalar.Z)); }
public static IVec3 Scale(IVec3 vec, float scalar) { return(vec.GetNewInstance(vec.X * scalar, vec.Y * scalar, vec.Z * scalar)); }