Пример #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);
 }