Exemplo n.º 1
0
        public Vec2D Project(Vec2D target)
        {
            Vec2D temp = Clone();

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

            vec.SetTo(x, y);
            return(vec);
        }
Exemplo n.º 3
0
        public Vec2D Clone()
        {
            Vec2D clone = Pool.Acquire();

            clone.X = X;
            clone.Y = Y;
            return(clone);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public float Dot(Vec2D vector)
 {
     return((X * vector.X) + (Y * vector.Y));
 }
Exemplo n.º 6
0
 public static void RecycleToPool(Vec2D vec)
 {
     Pool.Release(vec);
 }