mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-11 02:45:52 +01:00
fix precision bug
This commit is contained in:
parent
2cef19994d
commit
b975381cfa
1 changed files with 3 additions and 3 deletions
|
|
@ -189,14 +189,14 @@ TCAD.craft.deleteRedundantPoints = function(path) {
|
|||
var a = path[pi];
|
||||
var b = path[bIdx];
|
||||
var c = path[(pi + 2) % pathLength];
|
||||
var eq = TCAD.utils.equal;
|
||||
if (!eq(a.minus(b).unit().dot(a.minus(c).unit()), 1)) {
|
||||
var eq = TCAD.utils.areEqual;
|
||||
if (!eq(a.minus(b).unit().dot(a.minus(c).unit()), 1, 1E-20)) {
|
||||
cleanedPath.push(b);
|
||||
for (var ii = 0; ii < pathLength - pi - 1; ++ii) {
|
||||
a = path[(ii + bIdx) % pathLength];
|
||||
b = path[(ii + bIdx + 1) % pathLength];
|
||||
c = path[(ii + bIdx + 2) % pathLength];
|
||||
if (!eq(a.minus(b).unit().dot(a.minus(c).unit()), 1)) {
|
||||
if (!eq(a.minus(b).unit().dot(a.minus(c).unit()), 1, 1E-20)) {
|
||||
cleanedPath.push(b);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue