### Contents Boost.Polygon Main Page Design Overview Isotropy Coordinate Concept Interval Concept Point Concept Segment Concept Rectangle Concept Polygon 90 Concept Polygon 90 With Holes Concept Polygon 45 Concept Polygon 45 With Holes Concept Polygon Concept Polygon With Holes Concept Polygon 90 Set Concept Polygon 45 Set Concept Polygon Set Concept Connectivity Extraction 90 Connectivity Extraction 45 Connectivity Extraction Property Merge 90 Property Merge 45 Property Merge Voronoi Main Page Voronoi Benchmark Voronoi Builder Voronoi Diagram ### Other Resources GTL Boostcon 2009 Paper GTL Boostcon 2009 Presentation Performance Analysis Layout Versus Schematic Tutorial Minkowski Sum Tutorial Voronoi Basic Tutorial Voronoi Advanced Tutorial ### Polygon Sponsor | # Polygon 45 With Holes Concept The polygon_45_with_holes concept tag is polygon_45_with_holes_concept To register a user defined type as a model of polygon_45_with_holes concept, specialize the geometry concept meta-function for that type. In the example below CPolygon45WithHoles is registered as a model of polygon_45_with_holes concept. template <> struct geometry_concept<CPolygon45WithHoles> { typedef polygon_45_with_holes_concept type; }; The semantic of a polygon_45_with_holes is a polygon_45 that it can provide iterators over holes that are also polygon_45. A mutable polygon_45_with_holes must also be able to set its geometry based on an interator range over polygon_45 holes. There is no convention of winding of holes enforced within the library. Below is shown the default polygon with holes traits. Specialization of these traits is required for types that don't conform to the default behavior. template <typename T, typename enable = void> struct polygon_with_holes_traits { typedef typename T::iterator_holes_type iterator_holes_type; typedef typename T::hole_type hole_type; static inline iterator_holes_type begin_holes(const T& t) { return t.begin_holes(); } static inline iterator_holes_type end_holes(const T& t) { return t.end_holes(); } static inline unsigned int size_holes(const T& t) { return t.size_holes(); } }; template <typename T, typename enable = void> struct polygon_with_holes_mutable_traits { template <typename iT> static inline T& set_holes(T& t, iT inputBegin, iT inputEnd) { t.set_holes(inputBegin, inputEnd); return t; } }; An object that is a model of polygon_45_with_holes_concept can be viewed as a model of any of its refinements if it is determined at runtime to conform to the restriction of those concepts. This concept casting is accomplished through the view_as<>() function. view_as<rectangle_concept>(polygon_45_with_holes_object) view_as<polygon_90_concept>(polygon_45_with_holes_object) view_as<polygon_90_with_holes_concept>(polygon_45_with_holes_object) view_as<polygon_45_concept>(polygon_45_with_holes_object) The return value of view_as<>() can be passed into any interface that expects an object of the conceptual type specified in its template parameter. ## Functions
template <typename T> point_iterator_type begin_points(const T& polygon) | Expects a model of polygon_45_with_holes. Returns the begin iterator over the range of points that correspond to vertices of the polygon.
template <typename T> point_iterator_type end_points(const T& polygon) | Expects a model of polygon_45_with_holes. Returns the end iterator over the range of points that correspond to vertices of the polygon.
template <typename T> hole_iterator_type begin_holes(const T& polygon) | Expects a model of polygon_45_with_holes. Returns the begin iterator over the range of coordinates that correspond to horizontal and vertical edges.
template <typename T> hole_iterator_type end_holes(const T& polygon) | Expects a model of polygon_45_with_holes. Returns the end iterator over the range of coordinates that correspond to horizontal and vertical edges.
template <typename T, typename iterator> void set_points(T& polygon, iterator b, iterator e) | Expects a model of polygon_45_with_holes. Sets the polygon to the point data range [b,e) that corresponds to vertices of a polygon.
template <typename T, typename iterator> void set_holes(T& polygon, iterator b, iterator e) | Expects a model of polygon_45_with_holes. Sets the polygon holes to the hole data range [b,e)
template <typename T> unsigned int size(const T& polygon) | Returns the number of edges in the outer shell of the polygon_45_with_holes. Does not include sizes of the holes.
template <typename T1, typename T2> T1& assign(T1& left, const T2& right) | Copies data from right object that models polygon_45_with_holes or one of its refinements into left object that models polygon_45_with_holes.
template <typename T, typename point_type> bool contains(const T&, const point_type& point, bool consider_touch=true) | Given an object that models polygon_45_with_holes and an object that models point, returns true if the polygon shell contains the point and one of its holes does not contain the point. If the consider_touch flag is true will return true if the point lies along the boundary of the polygon or one of its holes.
// get the center coordinate template <typename T, typename point_type> void center(point_type& p, const T& polygon) | Sets object that models point to the center point of the bounding box of an object that models polygon_45_with_holes.
template <typename T, typename rectangle_type> bool extents(rectangle_type& bbox, const T& polygon) | Sets object that models rectangle to the bounding box of an object that models polygon_45_with_holes and returns true. Returns false and leaves bbox unchanged if polygon is empty.
template <typename T> manhattan_area_type area(const T& polygon) | Returns the area of an object that models polygon_45_with_holes including subtracting the area of its holes from the area of the outer shell polygon.
template <typename T> direction_1d winding(const T& polygon) | Returns the winding direction of an object that models polygon_45_with_holes, LOW == CLOCKWISE, HIGH = COUNTERCLOCKWISE.
template <typename T> coordinate_difference perimeter(const T& polygon) | Returns the perimeter length of an object that models polygon_45, including the perimeters of the holes.
template <typename T, typename transform_type> T& transform(T& polygon, const transform_type&) | Applies transform() on the vertices of polygon and sets the polygon to that described by the result of transforming its vertices. Also applies transform() on the holes of the polygon.
template <typename T> T& scale_up(T& polygon, unsigned_area_type factor) | Scales up outer shell and holes of an object that models polygon_45 by unsigned factor.
template <typename T> T& scale_down(T& polygon, unsigned_area_type factor) | Scales down outer shell and holes of an object that models polygon_45 by unsigned factor.
template <typename T, scaling_type> T& scale(T& rectangle, double scaling) | Scales outer shell and holes of an object that models polygon_45 by floating point factor.
template <typename T> T& move(T& polygon, orientation_2d, coordinate_difference displacement) | Adds displacement value to coordinate indicated by orientation_2d of vertices of an object that models polygon_45 .
template <typename polygon_type, typename point_type> polygon_type& convolve(polygon_type& polygon, const point_type& point) | Convolves coordinate values of point with the outer shell and holes of an object that models polygon_45_with_holes.
# Polygon 45 With Holes Data The library provides a model of polygon 45 with holes concept declared template<typename T> polygon_45_with_holes_data where T is the coordinate type. This data type is used internally when a 45 degree polygon with holes is needed and is available to the library user who finds it convenient to use a library polygon data type instead of providing their own. The data type is implemented to be convenient to use with the library traits. ## Members
geometry_type | polygon_45_with_holes_concept
coordinate_type | T
iterator_type | Iterator over vertices point_data<T> vertices of polygon
iterator_holes_type | Iterator over hole polygons of type polygon_45_data<T>.
polygon_45_with_holes_data() | Default constructs the polygon.
polygon_45_with_holes_data(const polygon_45_with_holes_data& that) | Copy construct
polygon_45_with_holes_data& operator=(const polygon_45_with_holes_data& that) | Assignment operator.
template <typename T2> polygon_45_with_holes_data& operator=(const T2& that) const | Assign from an object that is a model of polygon 45 with holes.
iterator_type begin() const | Get the begin iterator over vertices of the polygon.
iterator_type end() const | Get the end iterator over vertices of the polygon.
iterator_hole_type begin_holes() const | Get the begin compact iterator over non-redundant coordinates of the polygon.
iterator_hole_type end_holes() const | Get the end compact iterator over non-redundant coordinates of the polygon.
std::size_t size() const | Get the number of elements in the sequence stored to the polygon, usually equal to the number of edges of the polygon.
std::size_t size_holes() const | Get the number of holes in the polygon
template <typename iT> void set(iT begin_points, iT end_points) | Sets the polygon to the iterator range of points. No check is performed to ensure the points describe a 45 degree figure.
template <typename iT> void set_holes(iT begin_holes, iT end_choless) | Sets the polygon holes the iterator range of hole polygons. These polygons in the input range may be either polygon_45_data or polygon_45_with_holes_data or any type that provides begin and end member functions to iterate over point_data<T>.
Copyright: | Copyright © Intel Corporation 2008-2010.
License: | Distributed under the Boost Software License, Version 1.0. (See accompanying file `LICENSE_1_0.txt` or copy at http://www.boost.org/LICENSE_1_0.txt)