Package ch.epfl.cs107.play.math.shape
Class Polygon
java.lang.Object
ch.epfl.cs107.play.math.shape.Shape
ch.epfl.cs107.play.math.shape.Polygon
Represents a polygon, without self-intersection.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Polygon
Creates a new polygon.- Parameters:
points- (List of Vector): sequence of vertices, not null
-
Polygon
Creates a new polygon.- Parameters:
points- (Array of points): sequence of vertices, not null
-
Polygon
public Polygon(float... points) Creates a new polygon.- Parameters:
points- (Array of float): sequence of vertices (x1, y1, x2, y2, etc.), not null
-
-
Method Details
-
getPoints
- Returns:
- (List of Vector): unmodifiable vertex list, 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
-