Package rekit.primitives.geometry
Class Polygon
java.lang.Object
rekit.primitives.geometry.Polygon
- All Implemented Interfaces:
Cloneable
This class defines a polygon.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new relative point.clone()float[]Get the absolute positions of all points.Get the start point of the polygon.voidMove a polygon to target location.rotate(float angle) Rotate the polygon by angle.Rotate the polygon by angle and anchor.scale(float scale) Scale this polygon.
-
Constructor Details
-
Polygon
Create the polygon by start position and other points.- Parameters:
startPoint- the first point's position in unitsrelPts- the relative positions of the next points relative tostartPointin units
-
-
Method Details
-
getStartPoint
Get the start point of the polygon.- Returns:
- the start point in units
-
clone
-
moveTo
Move a polygon to target location.- Parameters:
targetLocation- the target location in units
-
addRelPt
Add a new relative point.- Parameters:
relPt- the point
-
rotate
Rotate the polygon by angle.- Parameters:
angle- the angle- Returns:
- the rotated polygon
-
rotate
Rotate the polygon by angle and anchor.- Parameters:
angle- the anglerotationAnchor- the rotation anchor in units- Returns:
- the rotated polygon
-
getAbsoluteArray
public float[] getAbsoluteArray()Get the absolute positions of all points.- Returns:
- the points in units
-
scale
Scale this polygon.- Parameters:
scale- the factor- Returns:
- the result polygon
-