src/vertexmap.cpp

changeset 374
75efc3ba5a56
parent 338
719b909a7d2b
equal deleted inserted replaced
373:e34d6a30b96d 374:75efc3ba5a56
20 { 20 {
21 const glm::vec3& a; 21 const glm::vec3& a;
22 const glm::vec3& b; 22 const glm::vec3& b;
23 }; 23 };
24 24
25 inline void edges(const ModelElement& element, std::function<void(Edge&&)> fn) 25 static void edges(const PlainPolygonElement& element, std::function<void(Edge&&)> fn)
26 { 26 {
27 std::visit<void>(overloaded{ 27 std::visit<void>(overloaded{
28 [fn](const Colored<LineSegment>& edge) { 28 [fn](const LineSegment& edge) {
29 fn(Edge{edge.p1, edge.p2}); 29 fn(Edge{edge.p1, edge.p2});
30 }, 30 },
31 [fn](const Colored<Triangle>& triangle) { 31 [fn](const Triangle& triangle) {
32 fn(Edge{triangle.p1, triangle.p2}); 32 fn(Edge{triangle.p1, triangle.p2});
33 fn(Edge{triangle.p2, triangle.p3}); 33 fn(Edge{triangle.p2, triangle.p3});
34 fn(Edge{triangle.p3, triangle.p1}); 34 fn(Edge{triangle.p3, triangle.p1});
35 }, 35 },
36 [fn](const Colored<Quadrilateral>& quad) { 36 [fn](const Quadrilateral& quad) {
37 fn(Edge{quad.p1, quad.p2}); 37 fn(Edge{quad.p1, quad.p2});
38 fn(Edge{quad.p2, quad.p3}); 38 fn(Edge{quad.p2, quad.p3});
39 fn(Edge{quad.p3, quad.p4}); 39 fn(Edge{quad.p3, quad.p4});
40 fn(Edge{quad.p4, quad.p1}); 40 fn(Edge{quad.p4, quad.p1});
41 }, 41 },
42 [fn](const Colored<ConditionalEdge>& cedge) { 42 [fn](const ConditionalEdge& cedge) {
43 fn(Edge{cedge.p1, cedge.p2}); 43 fn(Edge{cedge.p1, cedge.p2});
44 }, 44 },
45 [](const ModelElement&&){}
46 }, element); 45 }, element);
47 } 46 }
48 47
49 inline void points( 48 inline void points(
50 const ModelElement& element, 49 const PlainPolygonElement& element,
51 std::function<void(const glm::vec3&)> fn) 50 std::function<void(const glm::vec3&)> fn)
52 { 51 {
53 std::visit<void>(overloaded{ 52 std::visit<void>(overloaded{
54 [fn](const Colored<LineSegment>& edge) { 53 [fn](const LineSegment& edge) {
55 fn(edge.p1); 54 fn(edge.p1);
56 fn(edge.p2); 55 fn(edge.p2);
57 }, 56 },
58 [fn](const Colored<Triangle>& triangle) { 57 [fn](const Triangle& triangle) {
59 fn(triangle.p1); 58 fn(triangle.p1);
60 fn(triangle.p2); 59 fn(triangle.p2);
61 fn(triangle.p3); 60 fn(triangle.p3);
62 }, 61 },
63 [fn](const Colored<Quadrilateral>& quad) { 62 [fn](const Quadrilateral& quad) {
64 fn(quad.p1); 63 fn(quad.p1);
65 fn(quad.p2); 64 fn(quad.p2);
66 fn(quad.p3); 65 fn(quad.p3);
67 fn(quad.p4); 66 fn(quad.p4);
68 }, 67 },
69 [fn](const Colored<ConditionalEdge>& cedge) { 68 [fn](const ConditionalEdge& cedge) {
70 fn(cedge.p1); 69 fn(cedge.p1);
71 fn(cedge.p2); 70 fn(cedge.p2);
72 fn(cedge.c1); 71 fn(cedge.c1);
73 fn(cedge.c2); 72 fn(cedge.c2);
74 }, 73 },

mercurial