Example #1
0
 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)
                ));
 }
Example #2
0
        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);
        }
Example #3
0
        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));
        }
Example #4
0
 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)));
 }
Example #5
0
 /// 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)));
 }
Example #6
0
 public static double Cross(Vector2Double lhs, Vector2Double rhs) => (lhs.x * rhs.y) - (lhs.y * rhs.x);
Example #7
0
 /// Dot product
 public static double Dot(Vector2Double lhs, Vector2Double rhs) => lhs.x * rhs.x + lhs.y * rhs.y;