summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0e1b384)
raw | patch | inline | side by side (parent: 0e1b384)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 14 Mar 2009 13:35:53 +0000 (13:35 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 14 Mar 2009 13:35:53 +0000 (13:35 +0000) |
src/line-snapper.cpp | patch | blob | history | |
src/object-snapper.cpp | patch | blob | history |
diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp
index 72a6cc33d54d5a7b1a2b784bbbf16732abd6e823..dee944afdf91f2b20d1a5532ce00997fbab59ec5 100644 (file)
--- a/src/line-snapper.cpp
+++ b/src/line-snapper.cpp
// std::cout << " line through " << i->second << " with normal " << i->first;
g_assert(i->first != Geom::Point(0,0)); // we cannot project on an linesegment of zero length
- Geom::Point const p_proj = project_on_linesegment(p, p1, p2);
+ Geom::Point const p_proj = Geom::projection(p, Geom::Line(p1, p2));
Geom::Coord const dist = Geom::L2(p_proj - p);
//Store any line that's within snapping range
if (dist < getSnapperTolerance()) {
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 0223ee132786e8270be27c3e7bc2670383933b3b..9a7053c4ce44b8a82da388908a3e8b01da0c099f 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
#include <2geom/path-intersection.h>
#include <2geom/point.h>
#include <2geom/rect.h>
+#include <2geom/line.h>
#include "document.h"
#include "sp-namedview.h"
#include "sp-image.h"
@@ -304,7 +305,7 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &s
for (std::vector<std::pair<Geom::Point, int> >::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) {
// Project each node (*k) on the guide line (running through point p)
- Geom::Point p_proj = project_on_linesegment((*k).first, p, p + Geom::rot90(guide_normal));
+ Geom::Point p_proj = Geom::projection((*k).first, Geom::Line(p, p + Geom::rot90(guide_normal)));
Geom::Coord dist = Geom::L2((*k).first - p_proj); // distance from node to the guide
Geom::Coord dist2 = Geom::L2(p - p_proj); // distance from projection of node on the guide, to the mouse location
if ((dist < tol && dist2 < tol) || (getSnapperAlwaysSnap() && dist < s.getSnapDistance())) {
// The intersection point of the constraint line with any path,
// must lie within two points on the constraintline: p_min_on_cl and p_max_on_cl
// The distance between those points is twice the snapping tolerance
- Geom::Point const p_proj_on_cl = project_on_linesegment(p, p1_on_cl, p2_on_cl);
+ Geom::Point const p_proj_on_cl = Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl));
Geom::Point const p_min_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl - getSnapperTolerance() * direction_vector);
Geom::Point const p_max_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl + getSnapperTolerance() * direction_vector);