Polygon deflated

Geometric functions polygon deflated

syntax

  • bp_polygon_dXD(polygon_data_item, deflatesize)
  • bp_polygon_dXHV(polygon_data_item, deflatesize)

with X one of 4, 8, 16 or X, and the same suffixes on bp_union_polygon, bp_split_polygon and bp_split_union_polygon.

These operators are deprecated: the kernel shape is an argument of minkowski_difference, so write bp_minkowski_difference(bp_polygon(g), size, '4D') instead of bp_polygon_d4D(g, size). They work, and every use logs a warning that names the replacement; Boost polygon functions has the table for all of them.

description

These operators result in deflated versions of an original polygon_data_item. They differ in how the corners are treated, as the figure shows for four of them.

X is the degree of roundness: the number of points of the kernel, 4, 8 or 16, or X for a star shape. The suffix D or HV gives the kernel: diagonal (diamond-shaped) or horizontal-vertical (square-shaped).

The deflation uses the Minkowski sum method of Boost Polygon.

The deflatesize Parameter gives by how many units of the coordinate system the polygon is deflated.

applies to

  • Attribute polygon_data_item with an ipoint or spoint Value type.
  • parameter deflatesize with float64 value type.

conditions

  1. The composition type of the polygon_data_item needs to be polygon.
  2. The order of the points in the polygon_data_item needs to be clockwise for exterior bounds and counter clockwise for holes in polygons (right-hand-rule).

These operators give problems for integer coordinates larger than 2^25 after translation, with the first point moved to (0, 0). If your integer coordinates represent mm, 2^25[mm] is about 33[km]. The reason is that for calculating intersections, products of coordinates are calculated and cast to float64 with a 53 bits mantissa. Keep the size of your integer coordinates limited, and do not use mm precision for country borders, for instance; meter or kilometer may be sufficient.

since version

7.042

examples

The replacement of each deprecated operator, with the deprecated call in the comment:

// deflate building borders by 75 units, with a diamond-shaped kernel of 4 points
// (deprecated: bp_polygon_d4D(bld/border, 75d))
attribute<ipoint> building_deflated_4D75 (polygon, source/bld) := bp_minkowski_difference(bp_polygon(bld/border), 75d, '4D');

// the same with 8 points per corner (deprecated: bp_polygon_d8D(bld/border, 75d))
attribute<ipoint> building_deflated_8D75 (polygon, source/bld) := bp_minkowski_difference(bp_polygon(bld/border), 75d, '8D');

// the same with 16 points per corner (deprecated: bp_polygon_d16D(bld/border, 75d))
attribute<ipoint> building_deflated_16D75 (polygon, source/bld) := bp_minkowski_difference(bp_polygon(bld/border), 75d, '16D');

// with a horizontal-vertical, square-shaped kernel (deprecated: bp_polygon_d4HV(bld/border, 75d))
attribute<ipoint> building_deflated_4HV75 (polygon, source/bld) := bp_minkowski_difference(bp_polygon(bld/border), 75d, '4HV');

see also