Boost polygon functions - ObjectVision/GeoDMS GitHub Wiki
There are many polygon operators available in the GeoDMS. You might have seen some already. However, they can also be combined following a certain grammar. There are six base operators:
- polygon
- union_polygon
- partitioned_union_polygon
- split_polygon
- split_union_polygon
- split_partitioned_union_polygon
These can then be combined with the following suffixes:
- 'no suffix'
- _filtered = filter results on area. filter parameter, e.g., 3[meter] keeps all polygons with an area larger than 3[meter].
- _inflated = inflate with parameter value, e.g., 3[meter] which places an edge 3[meter] perpendicular to the original. This could result in very thin, pointy corners.
- _deflated
Since GeoDMS 20.18.0 the twelve kernel suffixes — _i4HV, _i4D, _i8D, _i16D, _iXHV,
_iXD and their _d… counterparts — are depreciated. They still work, but every
use logs a warning naming the replacement.
They existed because the kernel shape was part of the operator name. Twelve suffixes times the four forms {plain, union, split, split_union} is 48 registered operator names whose only job was to pick one of twelve fixed rings, and only boost.polygon had them. The kernel is now an argument to minkowski_sum / minkowski_difference, which all four geometry backends provide, and which also accept a kernel polygon of your own.
Suffix meaning was: _[a][X][y]
- a = i (inflate) or d (deflate) — now the choice between minkowski_sum and minkowski_difference
- X = degree of rounding = 4, 8, 16, X (x-shaped) — now part of the variant argument
- y = kernel shape = D (diagonal, diamond-shaped) or HV (horizontal and vertical, square-shaped)
Apply the Minkowski operator to the result of the same operator without the suffix:
| depreciated | replacement |
|---|---|
bp_polygon_i4HV(g, size) |
bp_minkowski_sum(bp_polygon(g), size, '4HV') |
bp_union_polygon_i8D(g, size) |
bp_minkowski_sum(bp_union_polygon(g), size, '8D') |
bp_union_polygon_i8D(g, part, size) |
bp_minkowski_sum(bp_union_polygon(g, part), size, '8D') |
bp_split_polygon_dXD(g, size) |
bp_split_polygon(bp_minkowski_difference(bp_polygon(g), size, 'XD')) |
bp_split_union_polygon_d8D(g, part, size) |
bp_split_polygon(bp_minkowski_difference(bp_union_polygon(g, part), size, '8D')) |
The old i/d-prefixed variant spellings are accepted as the variant literal too, so
'i4HV' works on minkowski_sum and 'd4HV' on minkowski_difference; a prefix that
disagrees with the operator is rejected rather than honoured.
What this costs. The suffixed operators folded the kernel step into the union/split pipeline and
kept the geometry in boost.polygon's own representation throughout. The replacement materialises one
intermediate polygon attribute the fused operator did not: one polygon for the union forms, one per
element otherwise. On the union forms that is negligible; on a large per-element attribute it is
one extra pass over the geometry.
What it buys. Any kernel, not just twelve; the same operator on GEOS (float64), boost geometry and CGAL, not only boost.polygon's integer coordinates; and 48 fewer mixed-case operator names.
If there is only a 'union' in the operator, the result is a parameter. If it contains split, it will create a new unit. If it contains a 'partitioned' it is an attribute within an existing domain.
parameter<rdc_mm> union (poly) := union_polygon(Wegdeel/geometry[rdc_mm]);
unit<uint32> split_union := split_union_polygon(Wegdeel/top10nl_wegdeel_vlak/geometry[rdc_mm]);
This first performs a union based on province_rel, and then splits them into multipolygons.
unit<uint32> split_partitioned_union := split_partitioned_union_polygon(Wegdeel/geometry[rdc_mm], Wegdeel/province_rel);
-
minkowski_sum - the replacement for the twelve
_i…suffixes -
minkowski_difference - the replacement for the twelve
_d…suffixes - polygon-operators