mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Filter out adjacent duplicate points.
This commit is contained in:
parent
df29ef2d2c
commit
4854e56e1d
1 changed files with 9 additions and 3 deletions
|
@ -22,9 +22,15 @@ var PathFitter = Base.extend({
|
|||
//console.log(path.segments + '');
|
||||
this.maxIterations = 4;
|
||||
this.points = [];
|
||||
var segments = path._segments;
|
||||
for (var i = 0, l = segments.length; i < l; i++)
|
||||
this.points[i] = segments[i].point.clone();
|
||||
var segments = path._segments,
|
||||
prev;
|
||||
for (var i = 0, l = segments.length; i < l; i++) {
|
||||
var point = segments[i].point.clone();
|
||||
if (!prev || !prev.equals(point)) {
|
||||
this.points[i] = point;
|
||||
prev = point;
|
||||
}
|
||||
}
|
||||
this.error = error;
|
||||
this.iterationError = error * error;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue