summaryrefslogtreecommitdiffstats
path: root/src/2geom/sbasis-geometric.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2geom/sbasis-geometric.cpp')
-rw-r--r--src/2geom/sbasis-geometric.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp
index 3fe27748e..275b09620 100644
--- a/src/2geom/sbasis-geometric.cpp
+++ b/src/2geom/sbasis-geometric.cpp
@@ -227,9 +227,9 @@ Geom::unitVector(D2<SBasis> const &V_in, double tol, unsigned order){
// -This approach is numerically bad. Find a stable way to rescale V_in to have non vanishing ends.
// -This done, unitVector will have jumps at zeros: fill the gaps with arcs of circles.
D2<SBasis> V = RescaleForNonVanishingEnds(V_in);
+
if (V[0].isZero(tol) && V[1].isZero(tol))
return Piecewise<D2<SBasis> >(D2<SBasis>(Linear(1),SBasis()));
-
SBasis x = V[0], y = V[1];
SBasis r_eqn1, r_eqn2;
@@ -242,6 +242,7 @@ Geom::unitVector(D2<SBasis> const &V_in, double tol, unsigned order){
r_eqn1 = -(a*x+b*y);
r_eqn2 = Linear(1.)-(a*a+b*b);
+
for (unsigned k=1; k<=order; k++){
double r0 = (k<r_eqn1.size())? r_eqn1.at(k).at0() : 0;
double r1 = (k<r_eqn1.size())? r_eqn1.at(k).at1() : 0;
@@ -614,14 +615,14 @@ solve_lambda0(double a0,double a1,double c0,double c1,
* or
* value, speed, and cross(acceleration,speed)
* of the original curve at the both ends.
-* (the second is often technically usefull, as it avoids unnecessary division by |v|^2)
+* (the second is often technically useful, as it avoids unnecessary division by |v|^2)
* Recall that K=1/R=cross(acceleration,speed)/|speed|^3.
*
* Moreover, a 7-th argument 'insist_on_speed_signs' can be supplied to select solutions:
* If insist_on_speed_signs == 1, only consider solutions where speeds at both ends are positively
* proportional to the given ones.
* If insist_on_speed_signs == 0, allow speeds to point in the opposite direction (both at the same time)
-* If insist_on_speed_signs == -1, allow speeds to point in both direction independantly.
+* If insist_on_speed_signs == -1, allow speeds to point in both direction independently.
*
* \relates D2
*/