Polygon
in package
Polygon represented as a set of coordinates (vertices/points).
Table of Contents
Properties
Methods
- __construct() : mixed
- __toString() : string
- getCentroid() : Point
- Retrieves the centroid of the polygon.
- getCoordinates() : array<string|int, mixed>|null
- Retrieves the coordinates of the polygon.
- getMaxX() : float
- Retrieves the maximum X coordinate.
- getMaxY() : float
- Retrieves the maximum Y coordinate.
- getMinMaxX() : MinMax
- Retrieves the upper and lower bounds of the x-axis.
- getMinMaxY() : MinMax
- Retrieves the upper and lower bounds of the y-axis.
- getMinX() : float
- Retrieves the minimum X coordinate.
- getMinY() : float
- Retrieves the minimum Y coordinate.
- isEmpty() : bool
- Checks whether the Polygon has coordinates.
- isPointInX() : bool
- Checks whether a point is located within the polygon's x-axis.
- isPointInY() : bool
- Checks whether a point is located within the polygon's y-axis.
Properties
$coordinates
public
array<string|int, Point>|null
$coordinates
Vertices of the polygon.
$minMaxX
private
MinMax
$minMaxX
Min and max X values of the polygon.
$minMaxY
private
MinMax
$minMaxY
Min and max Y values of the polygon.
Methods
__construct()
public
__construct([array<string|int, mixed>|null $coordinates = null ]) : mixed
Parameters
- $coordinates : array<string|int, mixed>|null = null
-
Coordinates of the polygon as a set of Points.
__toString()
public
__toString() : string
Return values
string —String representation.
getCentroid()
Retrieves the centroid of the polygon.
public
getCentroid() : Point
Return values
PointgetCoordinates()
Retrieves the coordinates of the polygon.
public
getCoordinates() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetMaxX()
Retrieves the maximum X coordinate.
public
getMaxX() : float
Return values
floatgetMaxY()
Retrieves the maximum Y coordinate.
public
getMaxY() : float
Return values
floatgetMinMaxX()
Retrieves the upper and lower bounds of the x-axis.
public
getMinMaxX() : MinMax
Return values
MinMaxgetMinMaxY()
Retrieves the upper and lower bounds of the y-axis.
public
getMinMaxY() : MinMax
Return values
MinMaxgetMinX()
Retrieves the minimum X coordinate.
public
getMinX() : float
Return values
floatgetMinY()
Retrieves the minimum Y coordinate.
public
getMinY() : float
Return values
floatisEmpty()
Checks whether the Polygon has coordinates.
public
isEmpty() : bool
Return values
boolisPointInX()
Checks whether a point is located within the polygon's x-axis.
public
isPointInX(Point $point) : bool
Parameters
- $point : Point
-
Point to check.
Return values
boolisPointInY()
Checks whether a point is located within the polygon's y-axis.
public
isPointInY(Point $point) : bool
Parameters
- $point : Point
-
Point to check.