diff options
author | Jonathan deWerd <jjoonathan@gmail.com> | 2014-06-26 18:29:18 +0400 |
---|---|---|
committer | Jonathan deWerd <jjoonathan@gmail.com> | 2014-06-26 18:29:18 +0400 |
commit | c5b1bb13ae6224f6f3fb098117a94ea5071ff50b (patch) | |
tree | d100df60320522e6df16202baa86d1cc2d9dafb2 | |
parent | 7de89d945f34c03c3e1415e4a78064696a2befe5 (diff) |
Order bug fixed.
-rw-r--r-- | PolyTest/GridMesh.cpp | 5 | ||||
-rw-r--r-- | PolyTest/GridMesh.h | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/PolyTest/GridMesh.cpp b/PolyTest/GridMesh.cpp index f742acc664a..1c95ca50995 100644 --- a/PolyTest/GridMesh.cpp +++ b/PolyTest/GridMesh.cpp @@ -390,6 +390,9 @@ int GridMesh::insert_vert(int poly1left, return newv1; } +static bool intersection_edge_order(const IntersectingEdge& e1, const IntersectingEdge& e2) { + return e1.alpha1 < e2.alpha1; +} int GridMesh::insert_vert_poly_gridmesh(int mpoly) { std::vector<std::pair<int,int>> bottom_edges, left_edges, integer_cells; std::vector<std::vector<IntersectingEdge>> intersections; @@ -410,6 +413,7 @@ int GridMesh::insert_vert_poly_gridmesh(int mpoly) { std::vector<IntersectingEdge> isect_tmp = edge_poly_intersections(v1, cell_poly); isect.insert(isect.end(),isect_tmp.begin(),isect_tmp.end()); } + std::sort(isect.begin(),isect.end(),intersection_edge_order); intersections.push_back(isect); verts_added += isect.size(); v1=v2; v1x=v2x; v1y=v2y; @@ -449,7 +453,6 @@ std::vector<IntersectingEdge> GridMesh::edge_poly_intersections(int e1, int p) { } first_iter = false; } - std::sort(ret.begin(),ret.end()); return ret; } diff --git a/PolyTest/GridMesh.h b/PolyTest/GridMesh.h index dc66a55ad40..221a8fa787d 100644 --- a/PolyTest/GridMesh.h +++ b/PolyTest/GridMesh.h @@ -36,9 +36,6 @@ struct IntersectingEdge { double x,y,alpha1; int e2; // e2 and v[e2].next make up the intersecting edge IntersectingEdge(double x_, double y_, double a_, int v_) : x(x_), y(y_), alpha1(a_), e2(v_) {} - bool operator<(const IntersectingEdge& other) const { - return alpha1<other.alpha1; - } }; struct GridMesh { |