예제 #1
0
        public Vec2D Project(Vec2D target)
        {
            Vec2D temp = Clone();

            temp.ProjectThis(target);
            return(temp);
        }
예제 #2
0
        public static Vec2D GetFromPool(float x = 0f, float y = 0f)
        {
            Vec2D vec = Pool.Acquire();

            vec.SetTo(x, y);
            return(vec);
        }
예제 #3
0
        public Vec2D Clone()
        {
            Vec2D clone = Pool.Acquire();

            clone.X = X;
            clone.Y = Y;
            return(clone);
        }
예제 #4
0
        public void ProjectThis(Vec2D target)
        {
            Vec2D temp = Pool.Acquire();

            temp.X      = target.X;
            temp.Y      = target.Y;
            temp.Length = 1;
            temp.Length = Dot(temp);
            X           = temp.X;
            Y           = temp.Y;
            Pool.Release(temp);
        }
예제 #5
0
 public float Dot(Vec2D vector)
 {
     return((X * vector.X) + (Y * vector.Y));
 }
예제 #6
0
 public static void RecycleToPool(Vec2D vec)
 {
     Pool.Release(vec);
 }