39 for (
int c = 0; c < 3; ++c)
41 min[c] = std::numeric_limits<double>::max();
42 max[c] = std::numeric_limits<double>::lowest();
46 for (
int c = 0; c < 3; ++c)
48 min[c] = std::min(min[c], p[c]);
49 max[c] = std::max(max[c], p[c]);
57 for (
const int v : vertices)
74 for (
int i = 0; i < d; ++i)
76 const int i_v = d - 1 - i;
79 const int i_f = (i_v == 0) ? d - 1 : i_v - 1;
95 assert(to_delete.size() ==
n_facets());
97 std::vector<int> facets_old2new(
n_facets(), -1);
98 std::vector<int> new_facet_ptr = {0};
99 int new_nb_corners = 0;
100 for (
int f = 0; f <
n_facets(); ++f)
104 facets_old2new[f] = new_facet_ptr.size() - 1;
112 new_facet_ptr.push_back(new_nb_corners);
122 f = facets_old2new[f];
129 std::vector<int> next_corner_around_vertex(
n_corners(), -1);
132 for (
int f = 0; f <
n_facets(); ++f)
137 next_corner_around_vertex[c] = v2c[v];
145 for (
int f1 = 0; f1 <
n_facets(); ++f1)
153 for (
int c2 = next_corner_around_vertex[c1]; c2 != -1; c2 = next_corner_around_vertex[c2])
155 const int f2 = c2f[c2];
170 int nb_components = 0;
172 for (
int f = 0; f <
n_facets(); ++f)
174 if (component[f] != -1)
178 component[f] = nb_components;
181 const int cur_f = S.top();
186 if (adj_f != -1 && component[adj_f] == -1)
189 component[adj_f] = nb_components;
192 }
while (!S.empty());
195 return nb_components;
200 edges_.push_back({{v0, v1}});
std::vector< int > corner_vertex_
int create_edge(int v0, int v1)
void flip_facet(int f)
Reverses the orientation of facet f (its vertex list is reversed).
void clear()
Removes all vertices, facets and edges.
int create_polygon(const std::vector< int > &vertices)
Appends a polygon (not glued to its neighbors) and returns its index.
void bounding_box(Point &min, Point &max) const
Bounding box of the vertices (min/max are initialized to the largest and lowest doubles,...
std::vector< Point > points_
std::vector< int > facet_ptr_
int next_corner_around_facet(const int f, const int c) const
void connect_facets()
Glues every corner without neighbor to the facet sharing its edge in opposite orientation (already gl...
int corners_end(const int f) const
int n_facet_vertices(const int f) const
std::vector< bool > boundary_edge
Whether each edge is on the boundary.
std::vector< std::array< int, 2 > > edges_
std::vector< bool > boundary_vertex
Whether each vertex is on the boundary.
int create_vertices(int n)
Appends n vertices at the origin and returns the index of the first one.
void delete_facets(const std::vector< bool > &to_delete)
Removes the facets f with to_delete[f], keeping all vertices, and renumbers the remaining facets (and...
int prev_corner_around_facet(const int f, const int c) const
int create_vertex(const Point &p)
Appends a vertex and returns its index.
int corners_begin(const int f) const
int connected_components(std::vector< int > &component) const
Assigns to each facet the index of its connected component (through the corner adjacency) and returns...
std::vector< int > corner_edge
Index of the edge starting at each corner.
void clear_facets()
Removes all facets, keeping the vertices and the edges.
std::vector< int > corner_adjacent_facet_