Antkeeper  0.0.1
brep-loop.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ANTKEEPER_GEOM_BREP_LOOP_HPP
21 #define ANTKEEPER_GEOM_BREP_LOOP_HPP
22 
24 #include <cstddef>
25 
26 namespace geom {
27 
28 class brep_vertex;
29 class brep_edge;
30 class brep_face;
31 template <class T>
32 class brep_element_container;
33 
37 class brep_loop
38 {
39 public:
40  friend class brep_mesh;
41  friend class brep_edge_loop_list;
42  friend class brep_face_loop_list;
43  friend class brep_element_container<brep_loop>;
44  friend class brep_loop_container;
45  friend class brep_face_container;
46 
52  [[nodiscard]] inline constexpr std::size_t index() const noexcept
53  {
54  return m_index;
55  }
56 
58  [[nodiscard]] inline constexpr brep_vertex* vertex() const noexcept
59  {
60  return m_vertex;
61  }
62 
64  [[nodiscard]] inline constexpr brep_edge* edge() const noexcept
65  {
66  return m_edge;
67  }
68 
70  [[nodiscard]] inline constexpr brep_face* face() const noexcept
71  {
72  return m_face;
73  }
74 
76  [[nodiscard]] inline constexpr brep_loop* next() const noexcept
77  {
78  return m_face_next;
79  }
80 
82  [[nodiscard]] inline constexpr brep_loop* previous() const noexcept
83  {
84  return m_face_previous;
85  }
86 
87 private:
88  std::size_t m_index;
89  brep_vertex* m_vertex;
90  brep_edge* m_edge;
91  brep_face* m_face;
92  brep_loop* m_edge_next;
93  brep_loop* m_edge_previous;
94  brep_loop* m_face_next;
95  brep_loop* m_face_previous;
96 };
97 
102 {
103 private:
104  friend class brep_mesh;
105  friend class brep_face_container;
106 
112  inline explicit brep_loop_container(brep_mesh* mesh) noexcept:
114  {}
115 
121  brep_loop* emplace_back() override;
122 };
123 
124 } // namespace geom
125 
126 #endif // ANTKEEPER_GEOM_BREP_LOOP_HPP
List of B-rep loops that share a common edge.
Definition: brep-edge.hpp:40
Curve segment bounded by two vertices.
Definition: brep-edge.hpp:237
Container for B-rep elements.
B-rep face container.
Definition: brep-face.hpp:275
List of B-rep loops that bound a common face.
Definition: brep-face.hpp:40
Portion of a shell bounded by loops.
Definition: brep-face.hpp:244
B-rep loop container.
Definition: brep-loop.hpp:102
Connected boundary of a single face.
Definition: brep-loop.hpp:38
constexpr brep_loop * next() const noexcept
Returns a pointer to the next loop.
Definition: brep-loop.hpp:76
constexpr std::size_t index() const noexcept
Returns the index of this loop in the mesh loop array.
Definition: brep-loop.hpp:52
constexpr brep_edge * edge() const noexcept
Returns a pointer to the loop edge.
Definition: brep-loop.hpp:64
constexpr brep_loop * previous() const noexcept
Returns a pointer to the previous loop.
Definition: brep-loop.hpp:82
constexpr brep_face * face() const noexcept
Returns a pointer to the loop face.
Definition: brep-loop.hpp:70
constexpr brep_vertex * vertex() const noexcept
Returns a pointer to the loop vertex.
Definition: brep-loop.hpp:58
Boundary representation (B-rep) of a mesh.
Definition: brep-mesh.hpp:34
A point in space.
Geometric algorithms.