Polygon inflated

Geometric functions polygon inflated

syntax

  • bp_polygon_iXD(polygon_data_item, inflatesize)
  • bp_polygon_iXHV(polygon_data_item, inflatesize)

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_sum, so write bp_minkowski_sum(bp_polygon(g), size, '4D') instead of bp_polygon_i4D(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 inflated 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 inflation uses the Minkowski sum method of Boost Polygon.

The inflatesize Parameter gives by how many units of the coordinate system the polygon is inflated.

applies to

  • Attribute polygon_data_item with an ipoint or spoint Value type.
  • parameter inflatesize 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:

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

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

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

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

see also