public static Polygon BuildRectangle(float x, float y, float width, float height) { Polygon result = new Polygon();// { collisionClass = PolygonCollisionClass.Rectangle }; result.AddVertex(x, y); result.AddVertex(x + width, y); result.AddVertex(x + width, y + height); result.AddVertex(x, y + height); return(result); }
public static Polygon BuildRectangle(float x, float y, float width, float height) { Polygon result = new Polygon(4); result.AddVertex(x, y); result.AddVertex(x + width, y); result.AddVertex(x + width, y + height); result.AddVertex(x, y + height); return(result); }
public static Polygon BuildCircle(int vertices, Vector2 center, float radius) { Polygon result = new Polygon();// { collisionClass = PolygonCollisionClass.Convex }; for (double i = 0; i < MathHelper.TwoPi; i += (float)MathHelper.TwoPi / (float)vertices) { result.AddVertex(center + radius * new Vector2((float)(Math.Cos(i)), (float)(Math.Sin(i)))); } return(result); }