summaryrefslogtreecommitdiffstats
path: root/src/perspective-line.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-08-17 16:22:23 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-08-17 16:22:23 +0000
commit187526a28b0756452e8701e015c30b6ffc9e6e28 (patch)
treedc8570104562a4843cc8a539877ae1719129a163 /src/perspective-line.cpp
parentMake sure style is invalidated when setting fill/stroke color in text objects (diff)
downloadinkscape-187526a28b0756452e8701e015c30b6ffc9e6e28.tar.gz
inkscape-187526a28b0756452e8701e015c30b6ffc9e6e28.zip
Draw perspective lines for infinite VPs, too (they are updated during scrolling or zooming); don't create knots for infinite VPs on the canvas
(bzr r3495)
Diffstat (limited to 'src/perspective-line.cpp')
-rw-r--r--src/perspective-line.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/perspective-line.cpp b/src/perspective-line.cpp
index e5596cc1b..9ee2d3578 100644
--- a/src/perspective-line.cpp
+++ b/src/perspective-line.cpp
@@ -12,6 +12,7 @@
*/
#include "perspective-line.h"
+#include "desktop.h"
namespace Box3D {
@@ -50,6 +51,23 @@ NR::Point PerspectiveLine::meet(Line const &line)
return *intersect(line); // works since intersect() does not return NR::Nothing()
}
+NR::Maybe<NR::Point> PerspectiveLine::intersection_with_viewbox (SPDesktop *desktop)
+{
+ NR::Rect vb = desktop->get_display_area();
+ /* remaining viewbox corners */
+ NR::Point ul (vb.min()[NR::X], vb.max()[NR::Y]);
+ NR::Point lr (vb.max()[NR::X], vb.min()[NR::Y]);
+
+ std::pair <NR::Point, NR::Point> e = side_of_intersection (vb.min(), lr, vb.max(), ul, this->pt, this->v_dir);
+ if (e.first == e.second) {
+ // perspective line lies outside the canvas
+ return NR::Nothing();
+ }
+
+ Line line (e.first, e.second);
+ return this->intersect (line);
+}
+
} // namespace Box3D
/*