Package ch.epfl.cs107.play.math.shape
Class Polyline
java.lang.Object
ch.epfl.cs107.play.math.shape.Shape
ch.epfl.cs107.play.math.shape.Polyline
Represents an open or closed sequence of segments. As it has no mass, it can only be used in fixed bodies.
-
Constructor Details
-
Polyline
Creates a new polyline.- Parameters:
closed- (boolean): whether last point is connected to the first onepoints- (List of Vector): at least two points, not null
-
Polyline
Creates a new polyline.- Parameters:
points- (List of Vector): at least two points, not null
-
Polyline
Creates a new polyline.- Parameters:
closed- (boolean): whether last point is connected to the first onepoints- (Array of Vector): at least two points, not null
-
Polyline
Creates a new polyline.- Parameters:
points- (Array of Vector): at least two points, not null
-
Polyline
public Polyline(boolean closed, float... points) Creates a new polyline.- Parameters:
closed- (boolean): whether last point is connected to the first onepoints- (Array of float): at least two points (x1, y1, x2, y2, etc.), not null
-
Polyline
public Polyline(float... points) Creates a new polyline.- Parameters:
points- at least two points, not null
-
-
Method Details
-
isClosed
public boolean isClosed()- Returns:
- (boolean): whether last point is connected to the first one
-
getPoints
- Returns:
- (List of Vector): an immutable list of points, not null
-
getArea
public float getArea() -
getPerimeter
public float getPerimeter()- Specified by:
getPerimeterin classShape- Returns:
- shape perimeter
-
sample
Description copied from class:ShapeSample uniform point inside shape, including border. -
toPath
-