20 return std::make_pair(std::min(v1, v2), std::max(v1, v2));
31 if (M.cells.nb() != 0 && M.facets.nb() == 0)
33 M.cells.compute_borders();
37 std::vector<std::pair<Edge, index_t>> e2c;
38 for (index_t f = 0; f < M.facets.nb(); ++f)
40 for (index_t c = M.facets.corners_begin(f); c < M.facets.corners_end(f); ++c)
42 index_t v = M.facet_corners.vertex(c);
43 index_t c2 = M.facets.next_corner_around_facet(f, c);
44 index_t v2 = M.facet_corners.vertex(c2);
45 e2c.emplace_back(make_edge(v, v2), c);
48 std::sort(e2c.begin(), e2c.end());
51 GEO::Attribute<index_t> c2e(M.facet_corners.attributes(),
"edge_id");
54 index_t current_id = -1;
55 std::vector<bool> boundary_edges;
56 for (
const auto &kv : e2c)
59 index_t c = kv.second;
62 M.edges.create_edge(e.first, e.second);
63 boundary_edges.push_back(
true);
69 boundary_edges.back() =
false;
74 GEO::Attribute<bool> boundary_edges_attr(M.edges.attributes(),
"boundary_edge");
75 assert(M.edges.nb() == (index_t)boundary_edges.size());
76 for (index_t e = 0; e < M.edges.nb(); ++e)
78 boundary_edges_attr[e] = boundary_edges[e] ? 1 : 0;
81 GEO::Attribute<bool> boundary_vertices(M.vertices.attributes(),
"boundary_vertex");
82 boundary_vertices.fill(0);
83 for (index_t e = 0; e < M.edges.nb(); ++e)
85 if (boundary_edges[e])
87 boundary_vertices[M.edges.vertex(e, 0)] = 1;
88 boundary_vertices[M.edges.vertex(e, 1)] = 1;
117 index_t c1 = M.facets.next_corner_around_facet(idx.
face, idx.
face_corner);
118 index_t v1 = M.facet_corners.vertex(c1);
119 if (v1 == M.edges.vertex(idx.
edge, 0) || v1 == M.edges.vertex(idx.
edge, 1))
127 index_t c2 = M.facets.prev_corner_around_facet(idx.
face, idx.
face_corner);
128 index_t v2 = M.facet_corners.vertex(c2);
129 assert(v2 == M.edges.vertex(idx.
edge, 0) || v2 == M.edges.vertex(idx.
edge, 1));
163 if (c2e[c1] != (index_t)idx.
edge)
165 c1 = M.facets.prev_corner_around_facet(idx.
face, c1);
167 index_t f2 = M.facet_corners.adjacent_facet(c1);
178 for (index_t c2 = M.facets.corners_begin(f2); c2 < M.facets.corners_end(f2); ++c2)
180 index_t v2 = M.facet_corners.vertex(c2);
181 if (v2 == (index_t)idx.
vertex)
188 logger().error(
"Not found");