15Inkscape::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)
45 _second_tolerance = 1;
46 _second_always_snap =
false;
49 _at_intersection =
false;
50 _fully_constrained =
false;
73 for (
const auto &
c : cs) {
78 if (this->_num_path ==
curve._num_path) {
80 if (this->_num_segm ==
curve._num_segm)
continue;
82 if (this->_num_segm ==
curve._num_segm + 1 &&
c.ta == 0 &&
c.tb == 1)
continue;
83 if (this->_num_segm + 1 ==
curve._num_segm &&
c.ta == 1 &&
c.tb == 0)
continue;
86 if (dist < best_dist) {
93 bool const use_this_as_primary = _distance <
curve.getSnapDistance();
98 best_p = best_p * dt2doc;
105 return SnappedPoint(best_p,
Inkscape::SNAPSOURCE_UNDEFINED, primaryC->
getSourceNum(),
Inkscape::SNAPTARGET_PATH_INTERSECTION, primaryDist, primaryC->
getTolerance(), primaryC->
getAlwaysSnap(),
true,
false,
true,
110 return SnappedPoint(
Geom::Point(
Geom::infinity(),
Geom::infinity()),
SNAPSOURCE_UNDEFINED, 0,
SNAPTARGET_UNDEFINED,
Geom::infinity(), 0,
false,
false,
false,
false,
Geom::infinity(), 0,
false);
134 for (
const auto &
c : cs) {
138 if (dist < best_dist) {
145 best_p = best_p * dt2doc;
151 Geom::L2(best_p - this->getPoint()), this->getTolerance(), this->getAlwaysSnap(),
true,
false,
true,
156 Geom::L2(best_p - this->getPoint()), this->getTolerance(), this->getAlwaysSnap());
161 return SnappedPoint(
Geom::Point(
Geom::infinity(),
Geom::infinity()),
SNAPSOURCE_UNDEFINED, 0,
SNAPTARGET_UNDEFINED,
Geom::infinity(), 0,
false,
false,
false,
false,
Geom::infinity(), 0,
false);
168 bool success =
false;
170 for (std::list<Inkscape::SnappedCurve>::const_iterator i = list.begin(); i != list.end(); ++i) {
174 if (paths_only && (not (*i).getOnPath())) {
178 if ((i == list.begin()) || (*i).getSnapDistance() <
result.getSnapDistance()) {
190 bool success =
false;
192 for (std::list<Inkscape::SnappedCurve>::const_iterator i = list.begin(); i != list.end(); ++i) {
195 std::list<Inkscape::SnappedCurve>::const_iterator j = i;
197 for (; j != list.end(); ++j) {
202 bool const c1 = !success;
209 if (c1 || c2 || c3) {
225 bool success =
false;
227 for (
const auto & i : curve_list) {
230 for (
const auto & j : line_list) {
235 bool const c1 = !success;
242 if (c1 || c2 || c3) {
3x3 matrix representing an affine transformation.
Abstract continuous curve on a plane defined on [0,1].
Line transformed(Affine const &m) const
Create a line transformed by an affine transformation.
LineSegment segment(Coord f, Coord t) const
Create a segment of this line.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Class describing the result of an attempt to snap to a curve.
Inkscape::SnappedPoint intersect(SnappedCurve const &curve, Geom::Point const &p, Geom::Affine dt2doc) const
Geom::Curve const * _curve
Class describing the result of an attempt to snap to a line.
Geom::Line getLine() const
Class describing the result of an attempt to snap.
Geom::Coord _second_distance
Geom::OptRect _target_bbox
Geom::Point getPoint() const
Geom::Coord getTolerance() const
bool getAlwaysSnap() const
Geom::Coord getSnapDistance() const
long getSourceNum() const
bool getAtIntersection() const
Geom::Coord getSecondSnapDistance() const
Geom::Coord _second_tolerance
constexpr Coord infinity()
Get a value representing infinity.
double Coord
Floating point type used to store coordinates.
Angle distance(Angle const &a, Angle const &b)
std::vector< Crossing > Crossings
SBasis L2(D2< SBasis > const &a, unsigned k)
SnapSourceType
enumerations of snap source types and snap target types.
@ SNAPTARGET_PATH_GUIDE_INTERSECTION
@ SNAPTARGET_PATH_INTERSECTION
bool getClosestIntersectionCS(std::list< Inkscape::SnappedCurve > const &list, Geom::Point const &p, Inkscape::SnappedPoint &result, Geom::Affine dt2doc)
bool getClosestIntersectionCL(std::list< Inkscape::SnappedCurve > const &curve_list, std::list< Inkscape::SnappedLine > const &line_list, Geom::Point const &p, Inkscape::SnappedPoint &result, Geom::Affine dt2doc)
bool getClosestCurve(std::list< Inkscape::SnappedCurve > const &list, Inkscape::SnappedCurve &result, bool exclude_paths, bool paths_only)