[Lemon-commits] deba: r3291 - lemon/trunk/tools

Lemon SVN svn at lemon.cs.elte.hu
Thu Jun 7 22:07:29 CEST 2007


Author: deba
Date: Thu Jun  7 22:07:29 2007
New Revision: 3291

Modified:
   lemon/trunk/tools/lgf-gen.cc

Log:
Correction for multiple point on starting sweep line



Modified: lemon/trunk/tools/lgf-gen.cc
==============================================================================
--- lemon/trunk/tools/lgf-gen.cc	(original)
+++ lemon/trunk/tools/lgf-gen.cc	Thu Jun  7 22:07:29 2007
@@ -281,9 +281,28 @@
 
   std::set<std::pair<int, int> > edges;
 
-  beach.insert(std::make_pair(Part(-1, siteheap[0].second, -1), 
-			      spikeheap.end()));
-  int siteindex = 1;
+  int siteindex = 0;
+  {
+    SiteHeap front;
+
+    while (siteindex < int(siteheap.size()) &&
+	   siteheap[0].first == siteheap[siteindex].first) {
+      front.push_back(std::make_pair(points[siteheap[siteindex].second].y,
+				     siteheap[siteindex].second));
+      ++siteindex;
+    }
+    
+    std::sort(front.begin(), front.end());
+
+    for (int i = 0; i < int(front.size()); ++i) {
+      int prev = (i == 0 ? -1 : front[i - 1].second);
+      int curr = front[i].second;
+      int next = (i + 1 == int(front.size()) ? -1 : front[i + 1].second);
+
+      beach.insert(std::make_pair(Part(prev, curr, next), 
+				  spikeheap.end()));      
+    }
+  }
 
   while (siteindex < int(points.size()) || !spikeheap.empty()) {
 
@@ -784,7 +803,7 @@
   std::cout << "Total edge length  : " << tlen << std::endl;
 
   if(ap["eps"])
-    graphToEps(g,prefix+".eps").
+    graphToEps(g,prefix+".eps").scaleToA4().
       scale(600).nodeScale(.2).edgeWidthScale(.001).preScale(false).
       coords(coords).run();
   



More information about the Lemon-commits mailing list