Skip to content

Commit

Permalink
Fix attribute dynamic range (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu authored Jul 21, 2023
1 parent ad8fa2e commit d7c0a53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/functions/src/weld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ function getAttributeTolerance(semantic: string, attribute: Accessor, tolerance:
_a.length = _b.length = 0;
attribute.getMinNormalized(_a);
attribute.getMaxNormalized(_b);
const range = Math.max(..._b) - Math.min(..._a) || 1;
const diff = _b.map((bi, i) => bi - _a[i]);
const range = Math.max(...diff);
return tolerance * range;
}

Expand Down

0 comments on commit d7c0a53

Please sign in to comment.