Record Class Polygon
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Polygon
- All Implemented Interfaces:
Shape
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this shape contains the specified point.static PolygoncreateCircle(float radius, int numPoints) Convenience method to create a polygon in the shape of a circle.static PolygoncreateCircle(Point2D origin, float radius, int numPoints) Convenience method to create a polygon in the shape of a circle.static PolygoncreateCone(Point2D origin, float angle, float arc, float length) Convenience method to create a cone-shaped polygon.static PolygoncreateCone(Point2D origin, Angle angle, float arc, float length) Convenience method to create a cone-shaped polygon.final booleanIndicates whether some other object is "equal to" this one.static PolygonfromPoints(float... points) Factory method that creates a polygon from an array of points, in the format[x0, y0, x1, y1, ...].Returns the smallest possible axis-aligned rectangle that contains this polygon.intDeprecated.getPoint(int n) Deprecated.floatgetPointX(int n) Deprecated.floatgetPointY(int n) Deprecated.final inthashCode()Returns a hash code value for this object.booleanReturns true if this polygon intersects with the specified other polygon.Applies the specified mapping function to each of the points within this polygon, and returns a new polygon based on those points.points()Returns the value of thepointsrecord component.reposition(Point2D offset) Returns a newShapeinstance that is repositioned by the specified offset.Subdivides this polygon into a number of triangles.float[]toPoints()Returns an array that contains the X and Y coordinates for all points within this polygon, in the format[x0, y0, x1, y1, ...].toString()Returns a string representation of this record class.Methods inherited from interface Shape
reposition
-
Constructor Details
-
Polygon
-
-
Method Details
-
toPoints
public float[] toPoints()Returns an array that contains the X and Y coordinates for all points within this polygon, in the format[x0, y0, x1, y1, ...]. -
getNumPoints
Deprecated. -
getPointX
Deprecated. -
getPointY
Deprecated. -
getPoint
Deprecated. -
contains
-
intersects
-
getBoundingBox
Returns the smallest possible axis-aligned rectangle that contains this polygon.- Specified by:
getBoundingBoxin interfaceShape
-
getCenter
-
subdivide
-
map
-
reposition
-
toString
-
fromPoints
Factory method that creates a polygon from an array of points, in the format[x0, y0, x1, y1, ...]. -
createCircle
-
createCircle
Convenience method to create a polygon in the shape of a circle. The circle will be centered aroundPoint2D.ORIGIN. -
createCone
-
createCone
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
points
-