Package io.fleetcoreplatform.Algorithms
Class PolygonPartitioner
java.lang.Object
io.fleetcoreplatform.Algorithms.PolygonPartitioner
Handles the subdivision of geographical areas into smaller, manageable chunks for drone swarms.
Uses a binary space partitioning (BSP) strategy to recursively divide a polygon into equal
halves.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.postgis.Geometry[]bisectPolygon(org.postgis.Geometry polygon, int depth, int maxDepth, double minArea) Recursively partitions a polygon into multiple sub-polygons up to a specified depth.
-
Constructor Details
-
PolygonPartitioner
public PolygonPartitioner()
-
-
Method Details
-
bisectPolygon
public static org.postgis.Geometry[] bisectPolygon(org.postgis.Geometry polygon, int depth, int maxDepth, double minArea) Recursively partitions a polygon into multiple sub-polygons up to a specified depth. At each step, it determines the bounding box's longest axis and bisects the polygon across its center. Recursion stops early if a sub-polygon's area falls below the minimum threshold or if it cannot form a valid shape.- Parameters:
polygon- The area geometry to partition.depth- The current zero-indexed recursion depth.maxDepth- The recursion limit. A value of N yields up to 2^N sub-polygons.minArea- The strict minimum area threshold. Regions below this size are kept intact without further splitting.- Returns:
- An array of the resulting partitioned geometries.
-