コード例 #1
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
 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)
                ));
 }
コード例 #2
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
        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);
        }
コード例 #3
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
        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));
        }
コード例 #4
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
 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)));
 }
コード例 #5
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
 /// 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)));
 }
コード例 #6
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
 public static double Cross(Vector2Double lhs, Vector2Double rhs) => (lhs.x * rhs.y) - (lhs.y * rhs.x);
コード例 #7
0
ファイル: Vector2Double.cs プロジェクト: nozgames/noz
 /// Dot product
 public static double Dot(Vector2Double lhs, Vector2Double rhs) => lhs.x * rhs.x + lhs.y * rhs.y;