33 size_t TriPos()
const {
return m_TriPos; }
43 bool operator() (
const tri_edge &
a,
const tri_edge &
b)
const;
47 typedef std::vector<tri_edge> edge_map;
50 void LinkNeighbours(
graph_array<triangle> & Triangles,
const edge_map & EdgeMap,
const tri_edge Edge);
59 assert(Triangles.
size() == (Indices.size() / 3));
62 for (
size_t i = 0;
i < Triangles.
size(); ++
i)
63 Triangles[
i] =
triangle(Indices[
i * 3 + 0], Indices[
i * 3 + 1], Indices[
i * 3 + 2]);
67 EdgeMap.reserve(Triangles.
size() * 3);
69 for (
size_t i = 0;
i < Triangles.
size(); ++
i) {
73 EdgeMap.push_back(tri_edge(Tri.
A(), Tri.
B(),
i));
74 EdgeMap.push_back(tri_edge(Tri.
B(), Tri.
C(),
i));
75 EdgeMap.push_back(tri_edge(Tri.
C(), Tri.
A(),
i));
78 std::sort(EdgeMap.begin(), EdgeMap.end(), cmp_tri_edge_lt());
81 for (
size_t i = 0;
i < Triangles.
size(); ++
i) {
85 LinkNeighbours(Triangles, EdgeMap, tri_edge(Tri.
B(), Tri.
A(),
i));
86 LinkNeighbours(Triangles, EdgeMap, tri_edge(Tri.
C(), Tri.
B(),
i));
87 LinkNeighbours(Triangles, EdgeMap, tri_edge(Tri.
A(), Tri.
C(),
i));
96 inline bool cmp_tri_edge_lt::operator() (
const tri_edge &
a,
const tri_edge &
b)
const 99 const index B1 = a.B();
100 const index A2 = b.A();
101 const index B2 = b.B();
103 if ((A1 < A2) || ((A1 == A2) && (B1 < B2)))
110 void LinkNeighbours(
graph_array<triangle> & Triangles,
const edge_map & EdgeMap,
const tri_edge Edge)
113 edge_map::const_iterator it = std::lower_bound(EdgeMap.begin(), EdgeMap.end(), Edge, cmp_tri_edge_lt());
118 for (; (it != EdgeMap.end()) && (Edge == (* it)); ++it)
119 Triangles.
insert_arc(Edge.TriPos(), it->TriPos());
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b
void make_connectivity_graph(graph_array< triangle > &Triangles, const indices &Indices)
out_arc_iterator insert_arc(nodeid Initial, nodeid Terminal)
std::vector< index > indices