diff options
Diffstat (limited to 'src/libnr/nr-point-fns.cpp')
| -rw-r--r-- | src/libnr/nr-point-fns.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/libnr/nr-point-fns.cpp b/src/libnr/nr-point-fns.cpp deleted file mode 100644 index e4fb8cf0b..000000000 --- a/src/libnr/nr-point-fns.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "libnr/nr-point-fns.h" - -Geom::Point -snap_vector_midpoint (Geom::Point const &p, Geom::Point const &begin, Geom::Point const &end, double snap) -{ - double length = Geom::distance(begin, end); - Geom::Point be = (end - begin) / length; - double r = Geom::dot(p - begin, be); - - if (r < 0.0) return begin; - if (r > length) return end; - - double snapdist = length * snap; - double r_snapped = (snap==0) ? r : floor(r/(snapdist + 0.5)) * snapdist; - - return (begin + r_snapped * be); -} - -// equivalent to Geom::LineSegment(begin, end).nearestPoint(p) -double -get_offset_between_points (Geom::Point const &p, Geom::Point const &begin, Geom::Point const &end) -{ - double length = Geom::distance(begin, end); - Geom::Point be = (end - begin) / length; - double r = Geom::dot(p - begin, be); - - if (r < 0.0) return 0.0; - if (r > length) return 1.0; - - return (r / length); -} - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : |
