summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
commit62ab3cc3fe08cee5968581360d1509a6b01ff9f1 (patch)
tree74e36cf0869c7fb8cc6ee457c353b09fcb96ead7 /src/2geom
parentCleanup variable declarations in ruler, and a couple of GSEAL fixes. (diff)
downloadinkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.tar.gz
inkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.zip
Enable tangential and perpendicular snapping to paths (in the node-tool, pen-tool, pencil-tool, and for guide manipulation; cannot be toggled yet, will always be active when snapping to paths)
(bzr r10886)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/sbasis-geometric.cpp17
-rw-r--r--src/2geom/sbasis-geometric.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp
index 017b377c9..0987953de 100644
--- a/src/2geom/sbasis-geometric.cpp
+++ b/src/2geom/sbasis-geometric.cpp
@@ -764,6 +764,23 @@ std::vector<double> find_normals(Point P, D2<SBasis> const &A) {
return roots(crs);
}
+/**
+* \brief returns all the parameter values of A whose normal is parallel to vector V.
+* \relates D2
+*/
+std::vector<double> find_normals_by_vector(Point V, D2<SBasis> const &A) {
+ SBasis crs = dot(derivative(A), V);
+ return roots(crs);
+}
+/**
+* \brief returns all the parameter values of A whose tangent is parallel to vector V.
+* \relates D2
+*/
+std::vector<double> find_tangents_by_vector(Point V, D2<SBasis> const &A) {
+ SBasis crs = dot(derivative(A), rot90(V));
+ return roots(crs);
+}
+
}
//}; // namespace
diff --git a/src/2geom/sbasis-geometric.h b/src/2geom/sbasis-geometric.h
index 00b64b430..43c624fb4 100644
--- a/src/2geom/sbasis-geometric.h
+++ b/src/2geom/sbasis-geometric.h
@@ -101,7 +101,9 @@ cubics_with_prescribed_curvature(Point const &M0, Point const &M1,
std::vector<double> find_tangents(Point P, D2<SBasis> const &A);
+std::vector<double> find_tangents_by_vector(Point V, D2<SBasis> const &A);
std::vector<double> find_normals(Point P, D2<SBasis> const &A);
+std::vector<double> find_normals_by_vector(Point V, D2<SBasis> const &A);
};