예제 #1
0
        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);
        }
예제 #2
0
 public static IVec2 Dot(IVec2 left, IVec2 right)
 {
     return(left.GetNewInstance(left.X * right.X, left.Y * right.Y));
 }
예제 #3
0
        public static IVec2 Normalized(IVec2 vec)
        {
            float dist = GetLength(vec);

            return(vec.GetNewInstance(vec.X / dist, vec.Y / dist));
        }
예제 #4
0
 public static IVec2 Scale(IVec2 vec, IVec2 scalar)
 {
     return(vec.GetNewInstance(vec.X * scalar.X, vec.Y * scalar.Y));
 }
예제 #5
0
 public static IVec2 Scale(IVec2 vec, float scalar)
 {
     return(vec.GetNewInstance(vec.X * scalar, vec.Y * scalar));
 }