fix corner case with identical offset fill points

This commit is contained in:
Stewart Allen 2020-05-06 14:54:03 -04:00
commit 7b2a2d32e1
2 changed files with 11 additions and 0 deletions

View file

@ -194,6 +194,10 @@ var gs_base_point = exports;
var c1 = dot(w, v);
var c2 = dot(v, v);
var b = c1 / c2;
if (isNaN(b)) {
// console.log('nan', {p, l1, l2, v, w, c1, c2});
b = 0;
}
var pb = {x: l1.x + b * v.x, y: l1.y + b * v.y};
return d(p, pb);
}