1 // Boost.Polygon library voronoi_geometry_type.hpp header file
2 
3 //          Copyright Andrii Sydorchuk 2010-2012.
4 // Distributed under the Boost Software License, Version 1.0.
5 //    (See accompanying file LICENSE_1_0.txt or copy at
6 //          http://www.boost.org/LICENSE_1_0.txt)
7 
8 // See http://www.boost.org for updates, documentation, and revision history.
9 
10 #ifndef BOOST_POLYGON_VORONOI_GEOMETRY_TYPE
11 #define BOOST_POLYGON_VORONOI_GEOMETRY_TYPE
12 
13 #include <cstddef>
14 
15 namespace boost {
16 namespace polygon {
17 // Represents topology type of the voronoi site.
18 enum GeometryCategory {
19   GEOMETRY_CATEGORY_POINT = 0x0,
20   GEOMETRY_CATEGORY_SEGMENT = 0x1
21 };
22 
23 // Represents category of the input source that forms Voronoi cell.
24 enum SourceCategory {
25   // Point subtypes.
26   SOURCE_CATEGORY_SINGLE_POINT = 0x0,
27   SOURCE_CATEGORY_SEGMENT_START_POINT = 0x1,
28   SOURCE_CATEGORY_SEGMENT_END_POINT = 0x2,
29 
30   // Segment subtypes.
31   SOURCE_CATEGORY_INITIAL_SEGMENT = 0x8,
32   SOURCE_CATEGORY_REVERSE_SEGMENT = 0x9,
33 
34   SOURCE_CATEGORY_GEOMETRY_SHIFT = 0x3,
35   SOURCE_CATEGORY_BITMASK = 0x1F
36 };
37 
belongs(SourceCategory source_category,GeometryCategory geometry_category)38 inline bool belongs(
39     SourceCategory source_category,
40     GeometryCategory geometry_category) {
41   return (static_cast<std::size_t>(source_category) >>
42               SOURCE_CATEGORY_GEOMETRY_SHIFT) ==
43          static_cast<std::size_t>(geometry_category);
44 }
45 }  // polygon
46 }  // boost
47 
48 #endif  // BOOST_POLYGON_VORONOI_GEOMETRY_TYPE
49