polyhedral_surface.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Boost.Geometry
  2. // Copyright (c) 2025 Siddharth Kumar, Roorkee, India.
  3. // Copyright (c) 2025 Oracle and/or its affiliates.
  4. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  5. // Use, modification and distribution is subject to the Boost Software License,
  6. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #ifndef BOOST_GEOMETRY_GEOMETRIES_POLYHEDRAL_SURFACE_HPP
  9. #define BOOST_GEOMETRY_GEOMETRIES_POLYHEDRAL_SURFACE_HPP
  10. #include <memory>
  11. #include <vector>
  12. #include <boost/concept/assert.hpp>
  13. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  14. #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
  15. #include <boost/geometry/core/tag.hpp>
  16. #include <boost/geometry/core/tags.hpp>
  17. #include <boost/config.hpp>
  18. namespace boost { namespace geometry
  19. {
  20. namespace model
  21. {
  22. /*!
  23. \brief A Polyhedral Surface is a contiguous collection of polygons in 3-dimensional space,
  24. which share common boundary segments. The concepts and the constructors don't check if the
  25. boundary segments are common but is_valid() does.
  26. \ingroup geometries
  27. \tparam Polygon polygon type
  28. \tparam Container container type for polygons,
  29. default std::vector
  30. \tparam Allocator container-allocator-type, for the polygons
  31. \qbk{[include reference/geometries/polyhedral_surface.qbk]}
  32. \qbk{before.synopsis,
  33. [heading Model of]
  34. [link geometry.reference.concepts.concept_polyhedral_surface PolyhedralSurface Concept]
  35. }
  36. */
  37. template
  38. <
  39. typename Polygon,
  40. template<typename, typename> class Container = std::vector,
  41. template<typename> class Allocator = std::allocator
  42. >
  43. class polyhedral_surface : public Container<Polygon, Allocator<Polygon> >
  44. {
  45. BOOST_CONCEPT_ASSERT( (concepts::Polygon<Polygon>) );
  46. public :
  47. using polygon_type = Polygon;
  48. using polygon_container = Container<Polygon, Allocator<Polygon> >;
  49. /// \constructor_default{polyhedron}
  50. inline polyhedral_surface()
  51. : polygon_container()
  52. {}
  53. /// \constructor_initialized_list{polyhedron}
  54. inline polyhedral_surface(std::initializer_list<Polygon> l)
  55. : polygon_container(l.begin(), l.end())
  56. {}
  57. };
  58. } // namespace model
  59. #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  60. namespace traits
  61. {
  62. template
  63. <
  64. typename Polygon,
  65. template<typename, typename> class Container,
  66. template<typename> class Allocator
  67. >
  68. struct tag
  69. <
  70. model::polyhedral_surface
  71. <
  72. Polygon,
  73. Container, Allocator
  74. >
  75. >
  76. {
  77. using type = polyhedral_surface_tag;
  78. };
  79. } // namespace traits
  80. #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  81. }} // namespace boost::geometry
  82. #endif // BOOST_GEOMETRY_GEOMETRIES_POLYHEDRAL_SURFACE_HPP