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.
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
$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 $base[, Polygon|null $target = null ]) : Polygon
Parameters
$base : Polygon

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

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

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