Skip to content

@technobuddha > library > Geometry

Polygon

NameTypeDescription
areaFunctionCalculates the area of a polygon given its vertices.
boundsFunctionCalculates the axis-aligned bounding rectangle for a given polygon.
centroidFunctionCalculates the centroid (geometric center) of a polygon.
convexHullFunctionComputes the convex hull of a set of 2D points using the Monotone Chain algorithm.
edgeAnglesFunctionGenerate normalized edge angles from polygon edges.
isClosedFunctionDetermines whether a given polygon is closed.
isIntersectingFunctionDetermines whether a given shape (either a LineSegment or a Polygon) intersects with a polygon.
isOnPolygonFunctionDetermines whether a given point lies exactly on the boundary of a polygon.
isPolygonFunctionDetermines if the provided object is a Polygon.
perimeterFunctionCalculates the perimeter of a polygon.
PolygonTypeA polygon (a set of cartesian coordinates)
regularPolygonFunctionGenerates a regular polygon.
rotateFunctionRotates a point or a polygon around a given origin by a specified angle.
scaleFunctionScales a point or a polygon of points around a given origin by a specified amount.
starFunctionGenerates a star-shaped polygon.
toClosedFunctionEnsures that a given polygon is closed by checking if the first and last points are the same. If the polygon is not closed, it appends the first point to the end of the array.
toPolygonFunctionConverts two Cartesian points or a Rect into a Polygon.
translateFunctionTranslate a point or polygon by a specified amount.