Correction for multiple point on starting sweep line
authordeba
Thu, 07 Jun 2007 20:07:29 +0000
changeset 24532800d9efb01d
parent 2452 24887f3a35ec
child 2454 c4554a95b0d3
Correction for multiple point on starting sweep line
tools/lgf-gen.cc
     1.1 --- a/tools/lgf-gen.cc	Tue Jun 05 17:30:52 2007 +0000
     1.2 +++ b/tools/lgf-gen.cc	Thu Jun 07 20:07:29 2007 +0000
     1.3 @@ -281,9 +281,28 @@
     1.4  
     1.5    std::set<std::pair<int, int> > edges;
     1.6  
     1.7 -  beach.insert(std::make_pair(Part(-1, siteheap[0].second, -1), 
     1.8 -			      spikeheap.end()));
     1.9 -  int siteindex = 1;
    1.10 +  int siteindex = 0;
    1.11 +  {
    1.12 +    SiteHeap front;
    1.13 +
    1.14 +    while (siteindex < int(siteheap.size()) &&
    1.15 +	   siteheap[0].first == siteheap[siteindex].first) {
    1.16 +      front.push_back(std::make_pair(points[siteheap[siteindex].second].y,
    1.17 +				     siteheap[siteindex].second));
    1.18 +      ++siteindex;
    1.19 +    }
    1.20 +    
    1.21 +    std::sort(front.begin(), front.end());
    1.22 +
    1.23 +    for (int i = 0; i < int(front.size()); ++i) {
    1.24 +      int prev = (i == 0 ? -1 : front[i - 1].second);
    1.25 +      int curr = front[i].second;
    1.26 +      int next = (i + 1 == int(front.size()) ? -1 : front[i + 1].second);
    1.27 +
    1.28 +      beach.insert(std::make_pair(Part(prev, curr, next), 
    1.29 +				  spikeheap.end()));      
    1.30 +    }
    1.31 +  }
    1.32  
    1.33    while (siteindex < int(points.size()) || !spikeheap.empty()) {
    1.34  
    1.35 @@ -784,7 +803,7 @@
    1.36    std::cout << "Total edge length  : " << tlen << std::endl;
    1.37  
    1.38    if(ap["eps"])
    1.39 -    graphToEps(g,prefix+".eps").
    1.40 +    graphToEps(g,prefix+".eps").scaleToA4().
    1.41        scale(600).nodeScale(.2).edgeWidthScale(.001).preScale(false).
    1.42        coords(coords).run();
    1.43