~inkscape.dev/inkscape/trunk

« back to all changes in this revision

Viewing changes to src/2geom/toposweep.h

  • Committer: Krzysztof Kosiński
  • Date: 2015-07-04 16:15:46 UTC
  • mfrom: (14059.2.18 lib2geom-sync)
  • Revision ID: tweenk.pl@gmail.com-20150704161546-t72563dl3qrj4yya
Sync 2Geom to revision 2413.
May introduce regressions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
/**
3
2
 * \file
4
3
 * \brief  TopoSweep - topology / graph representation of a PathVector, for boolean operations and related tasks
5
 
 *
 
4
 *//*
6
5
 * Authors:
7
6
 *              Michael Sloan <mgsloan at gmail.com>
8
7
 *              Nathan Hurst <njhurst at njhurst.com>
33
32
 * the specific language governing rights and limitations.
34
33
 */
35
34
 
36
 
#ifndef SEEN_GEOM_TOPOSWEEP_H
37
 
#define SEEN_GEOM_TOPOSWEEP_H
 
35
#ifndef LIB2GEOM_SEEN_TOPOSWEEP_H
 
36
#define LIB2GEOM_SEEN_TOPOSWEEP_H
38
37
 
39
38
#include <2geom/coord.h>
40
39
#include <2geom/point.h>
69
68
    Section(CurveIx cix, double fd, double td, Point fdp, Point tdp) : curve(cix), f(fd), t(td), fp(fdp), tp(tdp) { }
70
69
    Section(CurveIx cix, double fd, double td, PathVector ps, Dim2 d) : curve(cix), f(fd), t(td) {
71
70
        fp = curve.get(ps).pointAt(f), tp = curve.get(ps).pointAt(t);
72
 
        if (Point::LexOrderRt(d)(tp, fp)) {
 
71
        if (Point::LexLessRt(d)(tp, fp)) {
73
72
            //swap from and to, since tp is left or above fp
74
 
            std::swap(f, t);
75
 
            std::swap(fp, tp);
 
73
            using std::swap;
 
74
            swap(f, t);
 
75
            swap(fp, tp);
76
76
        }
77
77
    }
78
78
    Rect bbox() const { return Rect(fp, tp); }
167
167
    Dim2 dim;
168
168
    SweepSorter(Dim2 d) : dim(d) {}
169
169
    bool operator()(const Section &a, const Section &b) const {
170
 
        return Point::LexOrderRt(dim)(a.fp, b.fp);
 
170
        return Point::LexLessRt(dim)(a.fp, b.fp);
171
171
    }
172
172
};
173
173
 
208
208
 
209
209
} // end namespace Geom
210
210
 
211
 
#endif // SEEN_GEOM_TOPOSWEEP_H
 
211
#endif // LIB2GEOM_SEEN_TOPOSWEEP_H
212
212
 
213
213
/*
214
214
  Local Variables: