voronoi_geometry_type.hpp 1.4 KB

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