From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/snapped-curve.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/snapped-curve.h (limited to 'src/snapped-curve.h') diff --git a/src/snapped-curve.h b/src/snapped-curve.h new file mode 100644 index 0000000..bbbfb09 --- /dev/null +++ b/src/snapped-curve.h @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef SEEN_SNAPPEDCURVE_H +#define SEEN_SNAPPEDCURVE_H + +/** + * \file src/snapped-curve.h + * \brief SnappedCurve class. + * + * Authors: + * Diederik van Lierop + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include <2geom/forward.h> +#include +#include + +#include "snapped-point.h" +#include "snapped-line.h" + +namespace Inkscape { + +/// Class describing the result of an attempt to snap to a curve. +class SnappedCurve : public SnappedPoint +{ +public: + SnappedCurve(); + SnappedCurve(Geom::Point const &snapped_point, Geom::Point const &tangent, int num_path, int num_segm, Geom::Coord const &snapped_distance, Geom::Coord const &snapped_tolerance, bool const &always_snap, bool const &fully_constrained, Geom::Curve const *curve, SnapSourceType source, long source_num, SnapTargetType target, Geom::OptRect target_bbox); + ~SnappedCurve(); + Inkscape::SnappedPoint intersect(SnappedCurve const &curve, Geom::Point const &p, Geom::Affine dt2doc) const; //intersect with another SnappedCurve + Inkscape::SnappedPoint intersect(SnappedLine const &line, Geom::Point const &p, Geom::Affine dt2doc) const; //intersect with a SnappedLine + +private: + Geom::Curve const *_curve; + int _num_path; // Unique id of the path to which this segment belongs too + int _num_segm; // Sequence number of this segment in the path +}; + +} + +bool getClosestCurve(std::list const &list, Inkscape::SnappedCurve &result, bool exclude_paths = false); +bool getClosestIntersectionCS(std::list const &list, Geom::Point const &p, Inkscape::SnappedPoint &result, Geom::Affine dt2doc); +bool getClosestIntersectionCL(std::list const &list1, std::list const &list2, Geom::Point const &p, Inkscape::SnappedPoint &result, Geom::Affine dt2doc); + + +#endif /* !SEEN_SNAPPEDCURVE_H */ + +/* + 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 : -- cgit v1.2.3