[Bf-blender-cvs] [c5b1bb1] soc-2014-nurbs: Order bug fixed.

Jonathan deWerd noreply at git.blender.org
Fri Jun 27 08:14:47 CEST 2014


Commit: c5b1bb13ae6224f6f3fb098117a94ea5071ff50b
Author: Jonathan deWerd
Date:   Thu Jun 26 10:29:18 2014 -0400
https://developer.blender.org/rBc5b1bb13ae6224f6f3fb098117a94ea5071ff50b

Order bug fixed.

===================================================================

M	PolyTest/GridMesh.cpp
M	PolyTest/GridMesh.h

===================================================================

diff --git a/PolyTest/GridMesh.cpp b/PolyTest/GridMesh.cpp
index f742acc..1c95ca5 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 dc66a55..221a8fa 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 {




More information about the Bf-blender-cvs mailing list