diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-07-24 19:53:33 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-07-24 19:53:33 +0000 |
| commit | 5a37f06c70e0e4e2519812564f4dcdced7c0246a (patch) | |
| tree | f959f73813cb6f968072aee1100323b24e294136 /src/2geom/geom.cpp | |
| parent | update to trunk (diff) | |
| parent | Fix a bug continuing a bezier path whith a LPE one like spiro or bspline on a... (diff) | |
| download | inkscape-5a37f06c70e0e4e2519812564f4dcdced7c0246a.tar.gz inkscape-5a37f06c70e0e4e2519812564f4dcdced7c0246a.zip | |
update to trunk
(bzr r13879.1.17)
Diffstat (limited to 'src/2geom/geom.cpp')
| -rw-r--r-- | src/2geom/geom.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/2geom/geom.cpp b/src/2geom/geom.cpp index d3cf0ca73..bf9b0a721 100644 --- a/src/2geom/geom.cpp +++ b/src/2geom/geom.cpp @@ -10,8 +10,17 @@ #include <algorithm> #include <2geom/rect.h> +using std::swap; + namespace Geom { +enum IntersectorKind { + intersects = 0, + parallel, + coincident, + no_intersection +}; + /** * Finds the intersection of the two (infinite) lines * defined by the points p such that dot(n0, p) == d0 and dot(n1, p) == d1. @@ -305,7 +314,7 @@ rect_line_intersect(Geom::Point const &c0, Geom::Point const &c1, Point dir1 (results[1] - results[0]); Point dir2 (p1 - p0); if (dot(dir1, dir2) < 0) { - std::swap(results[0], results[1]); + swap(results[0], results[1]); } } @@ -363,7 +372,7 @@ int centroid(std::vector<Geom::Point> const &p, Geom::Point& centroid, double &a Geom::Point centroid_tmp(0,0); double atmp = 0; for (unsigned i = n-1, j = 0; j < n; i = j, j++) { - const double ai = -cross(p[j], p[i]); + const double ai = cross(p[j], p[i]); atmp += ai; centroid_tmp += (p[j] + p[i])*ai; // first moment. } |
