diff options
Diffstat (limited to 'src/2geom/sbasis-geometric.cpp')
| -rw-r--r-- | src/2geom/sbasis-geometric.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp index 28e9fc964..c37118402 100644 --- a/src/2geom/sbasis-geometric.cpp +++ b/src/2geom/sbasis-geometric.cpp @@ -740,6 +740,18 @@ Geom::cubics_with_prescribed_curvature(Point const &M0, Point const &M1, return cubics_fitting_curvature(M0,M1,dM0,dM1,d2M0xdM0,d2M1xdM1,insist_on_speed_signs,epsilon); } + +/** +* \brief returns all the parameter values of A whose tangent passes through P. +*/ +std::vector<double> find_tangents(Point P, D2<SBasis> const &A) { + SBasis crs (cross(A - P, derivative(A))); + crs = shift(crs*Linear(-1, 0)*Linear(-1, 0), -2); // We know that there is a double root at t=0 so we divide out t^2 +// JFB points out that this is equivalent to (t-1)^2 followed by a divide by s^2 (shift) + return roots(crs); +} + + //}; // namespace |
