From dfd48bd9b4e9c017a5045b202deb7d9dd514e5b4 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 17 Aug 2007 18:42:23 +0000 Subject: Enable center-dragging of boxes ('in perspective') within the XY-plane (bzr r3497) --- src/line-geometry.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/line-geometry.h') 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 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); -- cgit v1.2.3