PolygonUtils
in package
AbstractYes
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.
- 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.
- 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 $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
PointisPointInX()
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 $base, Polygon $target) : Polygon
Parameters
Tags
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.