summaryrefslogtreecommitdiffstats
path: root/src/line-geometry.h
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-08-17 18:42:23 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-08-17 18:42:23 +0000
commitdfd48bd9b4e9c017a5045b202deb7d9dd514e5b4 (patch)
tree22e6dad0880bf0cf365f02fe5a41ccf139281a1f /src/line-geometry.h
parentFix skel-strokes example. (diff)
downloadinkscape-dfd48bd9b4e9c017a5045b202deb7d9dd514e5b4.tar.gz
inkscape-dfd48bd9b4e9c017a5045b202deb7d9dd514e5b4.zip
Enable center-dragging of boxes ('in perspective') within the XY-plane
(bzr r3497)
Diffstat (limited to 'src/line-geometry.h')
-rw-r--r--src/line-geometry.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/line-geometry.h b/src/line-geometry.h
index 7e731d4bc..cc0c9aaf4 100644
--- a/src/line-geometry.h
+++ b/src/line-geometry.h
@@ -35,7 +35,18 @@ public:
NR::Point closest_to(NR::Point const &pt); // returns the point on the line closest to pt
friend inline std::ostream &operator<< (std::ostream &out_file, const Line &in_line);
-//private:
+ friend NR::Point fourth_pt_with_given_cross_ratio (NR::Point const &A, NR::Point const &C, NR::Point const &D, double gamma);
+
+ double lambda (NR::Point const pt);
+ inline NR::Point point_from_lambda (double const lambda) {
+ return (pt + lambda * NR::unit_vector (v_dir)); }
+
+protected:
+ inline static bool pts_coincide (NR::Point const pt1, NR::Point const pt2)
+ {
+ return (NR::L2 (pt2 - pt1) < epsilon);
+ }
+
NR::Point pt;
NR::Point v_dir;
NR::Point normal;
@@ -48,6 +59,10 @@ std::pair<NR::Point, NR::Point> side_of_intersection (NR::Point const &A, NR::Po
NR::Point const &C, NR::Point const &D,
NR::Point const &pt, NR::Point const &dir);
+double cross_ratio (NR::Point const &A, NR::Point const &B, NR::Point const &C, NR::Point const &D);
+double cross_ratio (VanishingPoint const &V, NR::Point const &B, NR::Point const &C, NR::Point const &D);
+NR::Point fourth_pt_with_given_cross_ratio (NR::Point const &A, NR::Point const &C, NR::Point const &D, double gamma);
+
/*** For testing purposes: Draw a knot/node of specified size and color at the given position ***/
void create_canvas_point(NR::Point const &pos, double size = 4.0, guint32 rgba = 0xff00007f);