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