summaryrefslogtreecommitdiffstats
path: root/src/2geom/geom.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-07-24 23:26:11 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-07-24 23:26:11 +0000
commit7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5 (patch)
tree48cae26bf789b11d79f72efc16a6676f960eaaa6 /src/2geom/geom.cpp
parentupdate to trunk (diff)
parent3D box tool: the shift key must not prevent snapping of the vanishing point. ... (diff)
downloadinkscape-7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5.tar.gz
inkscape-7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5.zip
update to trunk
(bzr r12588.1.45)
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.
}