[geos-commits] r4120 - in branches/3.5: include/geos/triangulate/quadedge src/triangulate/quadedge

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Nov 21 08:01:35 PST 2015


Author: strk
Date: 2015-11-21 08:01:35 -0800 (Sat, 21 Nov 2015)
New Revision: 4120

Modified:
   branches/3.5/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h
   branches/3.5/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
Log:
use std::vector instead of std::list to avoid size() bottleneck

Patch by Daniel Baston via
https://github.com/libgeos/libgeos/pull/55

Modified: branches/3.5/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h
===================================================================
--- branches/3.5/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h	2015-11-21 12:59:28 UTC (rev 4119)
+++ branches/3.5/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h	2015-11-21 16:01:35 UTC (rev 4120)
@@ -78,7 +78,7 @@
  */
 class GEOS_DLL QuadEdgeSubdivision {
 public:
-	typedef std::list<QuadEdge*> QuadEdgeList;
+	typedef std::vector<QuadEdge*> QuadEdgeList;
 
 	/**
 	 * Gets the edges for the triangle to the left of the given {@link QuadEdge}.

Modified: branches/3.5/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
===================================================================
--- branches/3.5/src/triangulate/quadedge/QuadEdgeSubdivision.cpp	2015-11-21 12:59:28 UTC (rev 4119)
+++ branches/3.5/src/triangulate/quadedge/QuadEdgeSubdivision.cpp	2015-11-21 16:01:35 UTC (rev 4120)
@@ -17,6 +17,7 @@
  **********************************************************************/
 #include <geos/triangulate/quadedge/QuadEdgeSubdivision.h>
 
+#include <algorithm>
 #include <vector>
 #include <set>
 #include <iostream>
@@ -159,8 +160,8 @@
     QuadEdge::splice(e, e.oPrev());
     QuadEdge::splice(e.sym(), e.sym().oPrev());
 
-    // this is inefficient on an ArrayList, but this method should be called infrequently
-    quadEdges.remove(&e);
+    // this is inefficient on a std::vector, but this method should be called infrequently
+    quadEdges.erase(std::remove(quadEdges.begin(), quadEdges.end(), &e), quadEdges.end());
 
     //mark these edges as removed
     e.remove();



More information about the geos-commits mailing list