Documentation

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.
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
$polygon1 : Polygon

First polygon to compare.

$polygon2 : Polygon

Second polygon to compare.

Return values
int

createBoundingBoxFrom()

Creates a bounding box from one or two polygons.

public static createBoundingBoxFrom(Polygon|null $base[, Polygon|null $target = null ]) : Polygon
Parameters
$base : Polygon|null

First polygon.

$target : Polygon|null = null

Second polygon.

Return values
Polygon

getCentroid()

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
Point

getMaxXCoordinate()

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
throws
MindeeGeometryException

Throws if a maximum x-axis value cannot be found, e.g. if the polygon is empty.

Return values
float

getMaxYCoordinate()

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
throws
MindeeGeometryException

Throws if a maximum y-axis value cannot be found, e.g. if the polygon is empty.

Return values
float

getMinXCoordinate()

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
throws
MindeeGeometryException

Throws if a minimum x-axis value cannot be found, e.g. if the polygon is empty.

Return values
float

getMinYCoordinate()

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
throws
MindeeGeometryException

Throws if a minimum y-axis value cannot be found, e.g. if the polygon is empty.

Return values
float

isPointInPolygonX()

Checks whether a point is in a polygon's x-axis range.

public static isPointInPolygonX(Point $point, Polygon $polygon) : bool
Parameters
$point : Point

Point to check.

$polygon : Polygon

Polygon.

Return values
bool

isPointInPolygonY()

Checks whether a point is in a polygon's y-axis range.

public static isPointInPolygonY(Point $point, Polygon $polygon) : bool
Parameters
$point : Point

Point to check.

$polygon : Polygon

Polygon.

Return values
bool

isPointInX()

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
bool

isPointInY()

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
bool

polygonFromPrediction()

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
Polygon

quadrilateralFromPrediction()

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.

Tags
throws
MindeeGeometryException

Throws if the polygon isn't a quadrilateral.

Return values
Polygon

        
On this page

Search results