private Vector2 Project(Vector2 axis)
{
if (Vertices.Count == 0)
return Vector2.Zero;
float min = Vector2.Dot(new Vector2(GetWorldPosition(Vertices[0]).X, GetWorldPosition(Vertices[0]).Y), axis);
float max = min;
for (int i = 1; i < Vertices.Count; i++)
{
// NOTE: the axis must be normalized to get accurate projections
float p = Vector2.Dot(new Vector2(GetWorldPosition(Vertices[i]).X, GetWorldPosition(Vertices[i]).Y), axis);
if (p < min)
{
min = p;
}
else if (p > max)
{
max = p;
}
}
return new Vector2(min, max);
}