public class PolygonShape extends Shape
Fixture
.
A shape is convex if the line connecting any two points of the shape
always lies within the shape.
A body with a concave shape can be constructed from two or more convex shapes.
A polygon must have at least 3 and no more than 8 vertices.
Constructor and Description |
---|
PolygonShape(float... coords)
Initialise a convex polygon given a list of its vertices,
relative to the shape's origin.
|
PolygonShape(List<Vec2> vertices)
Initialise a convex polygon given a list of its vertices,
relative to the shape's origin.
|
public PolygonShape(List<Vec2> vertices)
vertices
- a list of vertex coordinatesIllegalArgumentException
- if the polygon is not convexpublic PolygonShape(float... coords)
coords
- the list of alternating x, y values for the vertex coordinates (in metres)IllegalArgumentException
- if the polygon is not convex or if coords is empty or not of even length