public static Vector2Double Mix(Vector2Double a, Vector2Double b, double weight) { return(new Vector2Double( MathEx.Mix(a.x, b.x, weight), MathEx.Mix(a.y, b.y, weight) )); }
public override bool Equals(object obj) { if (obj == null || obj.GetType() != GetType()) { return(false); } Vector2Double lhs = this; Vector2Double rhs = (Vector2Double)obj; return(lhs.x == rhs.x && lhs.y == rhs.y); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value == null) { return(Vector2Double.Zero); } if (value is string) { return(Vector2Double.Parse((string)value)); } return(base.ConvertFrom(context, culture, value)); }
public static Vector2Double Clamp(Vector2Double v, Vector2Double min, Vector2Double max) { return(new Vector2Double(MathEx.Clamp(v.x, min.x, max.x), MathEx.Clamp(v.y, min.y, max.y))); }
/// Return a vector that contains the minimum values of both components public static Vector2Double Min(Vector2Double a, Vector2Double b) { return(new Vector2Double(Math.Min(a.x, b.x), Math.Min(a.y, b.y))); }
public static double Cross(Vector2Double lhs, Vector2Double rhs) => (lhs.x * rhs.y) - (lhs.y * rhs.x);
/// Dot product public static double Dot(Vector2Double lhs, Vector2Double rhs) => lhs.x * rhs.x + lhs.y * rhs.y;