Other Resources

Polygon Sponsor

Polygon 90 Set Concept

The polygon_90_set concept tag is
polygon_90_set_concept

The semantic of a polygon_90_set is zero or more
Manhattan geometry regions.

The motivation for providing the
polygon_90_set_concept is that it is a very common special case of planar
geometry which afford the implementation of a variety of optimizations on the
general planar geometry algorithms. Manhattan geometry processing by the
polygon_90_set_concept can be 100X faster than arbitrary angle polygon
manipulation. Because the performance benefits are so large and the
special case is important enough, the library provides these performance
benefits for those application domains that require them.

Users are recommended to use std::vector and std::list of user defined polygons
or library provided polygon_90_set_data<coordinate_type> objects. Lists
and vectors of models of polygon_90_concept or polygon_90_with_holes_concept or
rectangle_concept are automatically models of polygon_90_set_concept.

Operators

The return type of some operators is the polygon_90_set_view
operator template type. This type is itself a model of the polygon_90_set
concept, but furthermore can be used as an argument to the polygon_90_set_data
constructor and assignment operator. The operator template exists to
eliminate temp copies of intermediate results when Boolean operators are chained
together.

Boolean OR operation (polygon set union). Accepts two objects
that model polygon_90_set or one of its refinements. Returns an
operator template that performs the operation on demand when chained or
or nested in a library function call such as assign(). O( n log n)
runtime complexity and O(n) memory wrt vertices + intersections.

Functions

Eliminates overlaps in geometry and copies from an object that
models polygon_90_set or any of its refinements into an object that
models polygon_90_set. O( n log n) runtime complexity and O(n)
memory wrt vertices + intersections.

Returns true if an object that models polygon_90_set or one of its
refinements covers the exact same geometric regions as another object
that models polygon_90_set or one of its refinements. For example:
two of polygon_90 objects. O( n log n) runtime complexity and O(n)
memory wrt vertices + intersections.

Output container is expected to be a standard container.
Slices geometry of an object that models polygon_90_set or one of its
refinements into non overlapping rectangles and appends them to the
output. O( n log n) runtime complexity and O(n) memory wrt
vertices + intersections.

Output container is expected to be a standard container. Given
an object that models polygon_90_set or one of its refinements finds all
overlapping rectangles that are maximal in area and appends them to the
output. Expected n log n runtime, worst case quadratic rutnime.

Computes bounding box of an object that models polygon_90_set and
stores it in an object that models rectangle. If the polygon set
is empty returns false. If there are holes outside of shells they
do not contribute to the extents of the polygon set. O( n log n)
runtime complexity and O(n) memory wrt vertices + intersections.

Given an object that models polygon_90_set and an object that models
polygon_90_set or one of its refinements, modifies a to retain only
regions that overlap or touch regions in b. O( n log n) runtime
complexity and O(n) memory wrt vertices + intersections.

template <typename T>
T& self_intersect(T& polygon_set)

Given an object that models polygon_90_set that has self overlapping
regions, modifies the argument to contain only the regions of overlap.
O( n log n) runtime complexity and O(n) memory wrt vertices +
intersections.

template <typename T>
T& self_xor(T& polygon_set)

Given an object that models polygon_90_set that has self overlapping
regions, modifies the argument to contain only the regions that do not
overlap. O( n log n) runtime complexity and O(n) memory wrt
vertices + intersections.

Same as getting all the rectangles of the inverse, bloating them and overwriting
the polygon set with the resulting regions then negating. O( n log
n) runtime complexity and O(n) memory wrt vertices + intersections.

Same as getting all the rectangles of the inverse, bloating them and overwriting
the polygon set with the resulting regions then negating. O( n log
n) runtime complexity and O(n) memory wrt vertices + intersections.

Same as getting all the rectangles of the inverse, bloating them and overwriting
the polygon set with the resulting regions then negating. O( n log
n) runtime complexity and O(n) memory wrt vertices + intersections.

Same as getting all the rectangles of the inverse, bloating them and overwriting
the polygon set with the resulting regions then negating. O( n log
n) runtime complexity and O(n) memory wrt vertices + intersections.

Same as getting all the rectangles of the inverse, bloating them and overwriting
the polygon set with the resulting regions then negating. O( n log
n) runtime complexity and O(n) memory wrt vertices + intersections.

Polygon 90 Set Data Object

The polygon 90 set data type encapsulates the internal data format that
serves as the input to the sweep-line algorithm that implements polygon-clipping
boolean operations. It also internally keeps track of whether that data
has been sorted or scanned and maintains the invariant that when its flags
indicate that the data is sorted or scanned the data has not been changed to
violate that assumption. Using the Polygon 90 Set Data type directly can
be more efficient than using lists and vectors of polygons in the functions
above because of the invariants it can enforce which provide the opportunity to
maintain the data is sorted form rather than going all the way out to polygons
then resorting those vertices for a subsequent operation.

The declaration of Polygon 90 Set Data is the following:

template <typename T>
class polygon_90_set_data;

The class is parameterized on the coordinate data type. Algorithms that
benefit from knowledge of the invariants enforced by the class are implemented
as member functions to provide them access to information about those
invariants.

Expects a standard container of geometry objects. Will scan
and eliminate overlaps. Converts polygon set geometry to objects
of that type and appends them to the container. Polygons will be
output with counterclockwise winding, hole polygons will be output with
clockwise winding. The last vertex of an output polygon is not the
duplicate of the first, and the number of points is equal to the number
of edges. O( n log n) runtime complexity and O(n) memory wrt
vertices + intersections.

Expects a standard container of polygon objects. Will scan and
eliminate overlaps. Converts polygon set geometry to polygons and
appends them to the container. Polygons will have holes fractured
out to the outer boundary along the positive direction of the scanline
orientation of the polygon set. O( n log n) runtime complexity and
O(n) memory wrt vertices + intersections.

Expects a standard container of rectangle objects. Will scan
and eliminate overlaps. Slices polygon set geometry to rectangles
along the given orientation and appends them to the container. O(
n log n) runtime complexity and O(n) memory wrt vertices +
intersections.

bool operator==(const polygon_90_set_data& p) const

Once scanned the data representation of geometry within a polygon
set is in a mathematically canonical form. Comparison between two
sets is therefore a linear time operation once they are in the scanned
state. Will scan and eliminate overlaps in both polygon sets. O( n
log n) runtime complexity and O(n) memory wrt vertices + intersections
the first time, linear subsequently.

bool operator!=(const polygon_90_set_data& p) const

Inverse logic of equivalence operator.

void clear()

Make the polygon set empty. Note: does not de-allocate memory.
Use shrink to fit idiom and assign default constructed polygon set to
de-allocate.

bool empty() const

Check whether the polygon set contains no geometry. Will scan
and eliminate overlaps because subtractive regions might make the
polygon set empty. O( n log n) runtime complexity and O(n) memory
wrt vertices + intersections the first time, linear subsequently.

orientation_2d orient() const

Get the scanning orientation. Depending on the data it is
sometimes more efficient to scan in a specific orientation. This
is particularly true of Manhattan geometry data. Constant time.

Given an object that models rectangle, scans and eliminates overlaps
in the polygon set because subtractive regions may alter its extents
then computes the bounding box and assigns it to extents_rectangle.
O( n log n) runtime complexity and O(n) memory wrt vertices +
intersections the first time, linear subsequently.

Scans to eliminate overlaps and subtractive regions. Inserts
rectangles of width specified by bloating values to the indicated side
of geometry within the polygon set and fills corners with rectangles of
the length and width specified for the adjacent sides. O( n log n)
runtime complexity and O(n) memory wrt vertices + intersections.

Scans to eliminate overlaps and subtractive regions. Inserts
subtractiive rectangles of width specified by bloating values to the
indicated side of geometry within the polygon set and subtractive
rectangle at convex corners of the length and width specified for the
adjacent sides. Scans to eliminate overlapping subtractive
regions. O( n log n) runtime complexity and O(n) memory wrt
vertices + intersections.