PolygonUtils
in package
Utility class for Polygon.
Table of Contents
Methods
- compareOnY() : int
- Compares two polygons on the Y axis. Returns a sort-compliant result (0;-1;1).
- createBoundingBoxFrom() : Polygon
- Creates a bounding box from one or two polygons.
- getCentroid() : Point
- Gets the centroid (Point) of a set of points.
- getMaxXCoordinate() : float
- Retrieves the maximum x coordinate of a Polygon.
- getMaxYCoordinate() : float
- Retrieves the maximum y coordinate of a Polygon.
- getMinXCoordinate() : float
- Retrieves the minimum x coordinate of a Polygon.
- getMinYCoordinate() : float
- Retrieves the minimum y coordinate of a Polygon.
- isPointInPolygonX() : bool
- Checks whether a point is in a polygon's x-axis range.
- isPointInPolygonY() : bool
- Checks whether a point is in a polygon's y-axis range.
- isPointInX() : bool
- Checks whether a point is located within a coordinate range on the x-axis.
- isPointInY() : bool
- Checks whether a point is located within a coordinate range on the y-axis.
- merge() : Polygon
- Merges two polygons.
- polygonFromPrediction() : Polygon
- Generates a Polygon from a given prediction.
- quadrilateralFromPrediction() : Polygon
- Generates a quadrilateral Polygon from a given prediction.
Methods
compareOnY()
Compares two polygons on the Y axis. Returns a sort-compliant result (0;-1;1).
public
static compareOnY(Polygon $polygon1, Polygon $polygon2) : int
Parameters
Return values
intcreateBoundingBoxFrom()
Creates a bounding box from one or two polygons.
public
static createBoundingBoxFrom(Polygon|null $base[, Polygon|null $target = null ]) : Polygon
Parameters
Return values
PolygongetCentroid()
Gets the centroid (Point) of a set of points.
public
static getCentroid(array<string|int, mixed> $vertices) : Point
Parameters
- $vertices : array<string|int, mixed>
-
Array of points.
Return values
PointgetMaxXCoordinate()
Retrieves the maximum x coordinate of a Polygon.
public
static getMaxXCoordinate(Polygon $polygon) : float
Parameters
- $polygon : Polygon
-
Polygon to get the minimum y coordinate of.
Tags
Return values
floatgetMaxYCoordinate()
Retrieves the maximum y coordinate of a Polygon.
public
static getMaxYCoordinate(Polygon $polygon) : float
Parameters
- $polygon : Polygon
-
Polygon to get the minimum y coordinate of.
Tags
Return values
floatgetMinXCoordinate()
Retrieves the minimum x coordinate of a Polygon.
public
static getMinXCoordinate(Polygon $polygon) : float
Parameters
- $polygon : Polygon
-
Polygon to get the minimum y coordinate of.
Tags
Return values
floatgetMinYCoordinate()
Retrieves the minimum y coordinate of a Polygon.
public
static getMinYCoordinate(Polygon $polygon) : float
Parameters
- $polygon : Polygon
-
Polygon to get the minimum y coordinate of.
Tags
Return values
floatisPointInPolygonX()
Checks whether a point is in a polygon's x-axis range.
public
static isPointInPolygonX(Point $point, Polygon $polygon) : bool
Parameters
Return values
boolisPointInPolygonY()
Checks whether a point is in a polygon's y-axis range.
public
static isPointInPolygonY(Point $point, Polygon $polygon) : bool
Parameters
Return values
boolisPointInX()
Checks whether a point is located within a coordinate range on the x-axis.
public
static isPointInX(Point $point, float $minX, float $maxX) : bool
Parameters
- $point : Point
-
Point to check.
- $minX : float
-
Lower bound.
- $maxX : float
-
Upper bound.
Return values
boolisPointInY()
Checks whether a point is located within a coordinate range on the y-axis.
public
static isPointInY(Point $point, float $minY, float $maxY) : bool
Parameters
- $point : Point
-
Point to check.
- $minY : float
-
Lower bound.
- $maxY : float
-
Upper bound.
Return values
boolmerge()
Merges two polygons.
public
static merge(Polygon|null $base, Polygon|null $target) : Polygon
Parameters
Tags
Return values
PolygonpolygonFromPrediction()
Generates a Polygon from a given prediction.
public
static polygonFromPrediction(array<string|int, mixed> $prediction) : Polygon
Parameters
- $prediction : array<string|int, mixed>
-
Raw prediction array.
Return values
PolygonquadrilateralFromPrediction()
Generates a quadrilateral Polygon from a given prediction.
public
static quadrilateralFromPrediction(array<string|int, mixed> $prediction) : Polygon
Parameters
- $prediction : array<string|int, mixed>
-
Raw prediction array.