summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-line_segment.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-04-12 12:59:26 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-04-12 12:59:26 +0000
commitf917248c6e109da63a0703e85520bac7318d4f39 (patch)
tree693d3357e750f360ae68791f3c093ea090567c81 /src/live_effects/lpe-line_segment.cpp
parentFix snapping during constrained translation, when only snapping the node clos... (diff)
downloadinkscape-f917248c6e109da63a0703e85520bac7318d4f39.tar.gz
inkscape-f917248c6e109da63a0703e85520bac7318d4f39.zip
Use the line intersection routines in 2geom/line.h instead of the deprecated ones in 2geom/geom.h. (I know we're in a refactoring freeze, but this one I was already working on before this freeze was announced and it's quite safe IMHO. It's only a small change in 2geom's API and can hardly do any real harm. I will not refactor anything else until after the v0.47 release, promised!)
(bzr r7688)
Diffstat (limited to 'src/live_effects/lpe-line_segment.cpp')
-rw-r--r--src/live_effects/lpe-line_segment.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp
index 9a7d3cfbc..df5619002 100644
--- a/src/live_effects/lpe-line_segment.cpp
+++ b/src/live_effects/lpe-line_segment.cpp
@@ -53,29 +53,29 @@ LPELineSegment::doBeforeEffect (SPLPEItem *lpeitem)
std::vector<Geom::Path>
LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in)
{
- using namespace Geom;
std::vector<Geom::Path> output;
A = initialPoint(path_in);
B = finalPoint(path_in);
- std::vector<Point> intersections = rect_line_intersect(bboxA, bboxB, A, B);
+ Geom::Rect dummyRect(bboxA, bboxB);
+ boost::optional<Geom::LineSegment> intersection_segment = Geom::rect_line_intersect(dummyRect, Geom::Line(A, B));
- if (intersections.size() < 2) {
+ if (!intersection_segment) {
g_print ("Possible error - no intersection with limiting bounding box.\n");
return path_in;
}
if (end_type == END_OPEN_INITIAL || end_type == END_OPEN_BOTH) {
- A = intersections[0];
+ A = (*intersection_segment).initialPoint();
}
if (end_type == END_OPEN_FINAL || end_type == END_OPEN_BOTH) {
- B = intersections[1];
+ B = (*intersection_segment).finalPoint();
}
Geom::Path path(A);
- path.appendNew<LineSegment>(B);
+ path.appendNew<Geom::LineSegment>(B);
output.push_back(path);