Documentation

Polygon
in package

Polygon represented as a set of coordinates (vertices/points).

Table of Contents

Properties

$coordinates  : array<string|int, Point>|null
$minMaxX  : MinMax
$minMaxY  : MinMax

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
Point

getCoordinates()

Retrieves the coordinates of the polygon.

public getCoordinates() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getMaxX()

Retrieves the maximum X coordinate.

public getMaxX() : float
Return values
float

getMaxY()

Retrieves the maximum Y coordinate.

public getMaxY() : float
Return values
float

getMinMaxX()

Retrieves the upper and lower bounds of the x-axis.

public getMinMaxX() : MinMax
Return values
MinMax

getMinMaxY()

Retrieves the upper and lower bounds of the y-axis.

public getMinMaxY() : MinMax
Return values
MinMax

getMinX()

Retrieves the minimum X coordinate.

public getMinX() : float
Return values
float

getMinY()

Retrieves the minimum Y coordinate.

public getMinY() : float
Return values
float

isEmpty()

Checks whether the Polygon has coordinates.

public isEmpty() : bool
Return values
bool

isPointInX()

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
bool

isPointInY()

Checks whether a point is located within the polygon's y-axis.

public isPointInY(Point $point) : bool
Parameters
$point : Point

Point to check.

Return values
bool

        
On this page

Search results