diff --git a/src/snapped-line.h b/src/snapped-line.h
index 0b8c9053f8548315ec1e21d05c5683cc113aed06..3616058b0cb0d6e8a9195d68230fb501c998e953 100644 (file)
--- a/src/snapped-line.h
+++ b/src/snapped-line.h
/**
* \file src/snapped-line.h
- * \brief SnappedInfiniteLine class.
+ * \brief SnappedLine class.
*
* Authors:
* Diederik van Lierop <mail@diedenrezi.nl>
{
/// Class describing the result of an attempt to snap to a line segment.
-class SnappedLine : public SnappedPoint
+class SnappedLineSegment : public SnappedPoint
{
public:
- SnappedLine();
- SnappedLine(NR::Point snapped_point, NR::Coord snapped_distance, NR::Point start_point_of_line, NR::Point end_point_of_line);
- ~SnappedLine();
- Inkscape::SnappedPoint intersect(SnappedLine const &line) const; //intersect with another SnappedLine
+ SnappedLineSegment();
+ SnappedLineSegment(NR::Point snapped_point, NR::Coord snapped_distance, NR::Coord snapped_tolerance, bool always_snap, NR::Point start_point_of_line, NR::Point end_point_of_line);
+ ~SnappedLineSegment();
+ Inkscape::SnappedPoint intersect(SnappedLineSegment const &line) const; //intersect with another SnappedLineSegment
private:
- NR::Point _start_point_of_line;
- NR::Point _end_point_of_line;
+ NR::Point _start_point_of_line;
+ NR::Point _end_point_of_line;
};
-/// Class describing the result of an attempt to snap to an infinite line.
-class SnappedInfiniteLine : public SnappedPoint
+/// Class describing the result of an attempt to snap to a line.
+class SnappedLine : public SnappedPoint
{
public:
- SnappedInfiniteLine();
- SnappedInfiniteLine(NR::Point snapped_point, NR::Coord snapped_distance, NR::Point normal_to_line, NR::Point point_on_line);
- ~SnappedInfiniteLine();
- Inkscape::SnappedPoint intersect(SnappedInfiniteLine const &line) const; //intersect with another SnappedInfiniteLine
+ SnappedLine();
+ SnappedLine(NR::Point snapped_point, NR::Coord snapped_distance, NR::Coord snapped_tolerance, bool always_snap, NR::Point normal_to_line, NR::Point point_on_line);
+ ~SnappedLine();
+ Inkscape::SnappedPoint intersect(SnappedLine const &line) const; //intersect with another SnappedLine
// This line is described by this equation:
- // a*x + b*y = c <-> nx*px + ny+py = c <-> n.p = c
- NR::Point getNormal() const {return _normal_to_line;} // n = (nx, ny)
- NR::Point getPointOnLine() const {return _point_on_line;} // p = (px, py)
- NR::Coord getConstTerm() const {return dot(_normal_to_line, _point_on_line);} // c = n.p = nx*px + ny*py;
-
+ // a*x + b*y = c <-> nx*px + ny+py = c <-> n.p = c
+ NR::Point getNormal() const {return _normal_to_line;} // n = (nx, ny)
+ NR::Point getPointOnLine() const {return _point_on_line;} // p = (px, py)
+ NR::Coord getConstTerm() const {return dot(_normal_to_line, _point_on_line);} // c = n.p = nx*px + ny*py;
+
private:
- NR::Point _normal_to_line;
- NR::Point _point_on_line;
+ NR::Point _normal_to_line;
+ NR::Point _point_on_line;
};
}
-bool getClosestSIL(std::list<Inkscape::SnappedInfiniteLine> &list, Inkscape::SnappedInfiniteLine &result);
-bool getClosestIntersectionSIL(std::list<Inkscape::SnappedInfiniteLine> &list, Inkscape::SnappedPoint &result);
-bool getClosestIntersectionSIL(std::list<Inkscape::SnappedInfiniteLine> &list1, std::list<Inkscape::SnappedInfiniteLine> &list2, Inkscape::SnappedPoint &result);
+bool getClosestSLS(std::list<Inkscape::SnappedLineSegment> &list, Inkscape::SnappedLineSegment &result);
+bool getClosestIntersectionSLS(std::list<Inkscape::SnappedLineSegment> &list, Inkscape::SnappedPoint &result);
+bool getClosestSL(std::list<Inkscape::SnappedLine> &list, Inkscape::SnappedLine &result);
+bool getClosestIntersectionSL(std::list<Inkscape::SnappedLine> &list, Inkscape::SnappedPoint &result);
+bool getClosestIntersectionSL(std::list<Inkscape::SnappedLine> &list1, std::list<Inkscape::SnappedLine> &list2, Inkscape::SnappedPoint &result);
#endif /* !SEEN_SNAPPEDLINE_H */