public static void ProjectPolygon(Vector2f axis, ConvexShape polygon, ref float min, ref float max) { // To project a point on an axis use the dot product float dotProduct = Trig.DotProduct(axis, polygon.Transform.TransformPoint(polygon.GetPoint(0))); min = dotProduct; max = dotProduct; for (uint i = 0; i < polygon.GetPointCount(); i++) { dotProduct = Trig.DotProduct(polygon.Transform.TransformPoint(polygon.GetPoint(i)), axis); if (dotProduct < min) { min = dotProduct; } else { if (dotProduct > max) { max = dotProduct; } } } }