public static Vector2d Max(Vector2d lhs, Vector2d rhs) { return(new Vector2d(Mathd.Max(lhs.x, rhs.x), Mathd.Max(lhs.y, rhs.y))); }
public static double Distance(Vector2d a, Vector2d b) { return((a - b).magnitude); }
public static double SqrMagnitude(Vector2d a) { return(a.x * a.x + a.y * a.y); }
public static double Angle(Vector2d from, Vector2d to) { return(Mathd.Acos(Mathd.Clamp(Dot(from.normalized, to.normalized), -1d, 1d)) * 57.29578d); }
public static double Dot(Vector2d lhs, Vector2d rhs) { return(lhs.x * rhs.x + lhs.y * rhs.y); }
public void Scale(Vector2d scale) { x *= scale.x; y *= scale.y; }
public static Vector2d Scale(Vector2d a, Vector2d b) { return(new Vector2d(a.x * b.x, a.y * b.y)); }
public static Vector2d Lerp(Vector2d from, Vector2d to, double t) { t = Mathd.Clamp01(t); return(new Vector2d(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t)); }