summaryrefslogtreecommitdiffstats
path: root/src/2geom/geom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2geom/geom.cpp')
-rw-r--r--src/2geom/geom.cpp13
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.
}