Skip to content

Commit

Permalink
Remove duplicate points from kinks
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanwins committed Sep 5, 2017
1 parent 5b5502e commit f516639
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 89 deletions.
2 changes: 1 addition & 1 deletion packages/turf-kinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function (featureIn) {
coordinates.forEach(function (segment1) {
coordinates.forEach(function (segment2) {
for (var i = 0; i < segment1.length - 1; i++) {
for (var k = 0; k < segment2.length - 1; k++) {
for (var k = i; k < segment2.length - 1; k++) {
// don't check adjacent sides of a given segment, since of course they intersect in a vertex.
if (segment1 === segment2 && (Math.abs(i - k) === 1 || Math.abs(i - k) === segment1.length - 2)) {
continue;
Expand Down
11 changes: 0 additions & 11 deletions packages/turf-kinks/test/out/hourglass.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
-2.5
]
}
},
{
"type": "Feature",
"properties": {},
Expand Down
22 changes: 0 additions & 22 deletions packages/turf-kinks/test/out/multi-linestring.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,6 @@
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-39.7705078125,
-4.083452772038619
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
-8.798225459016345
]
}
},
{
"type": "Feature",
"properties": {},
Expand Down
22 changes: 0 additions & 22 deletions packages/turf-kinks/test/out/multi-polygon.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,6 @@
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-39.7705078125,
-4.083452772038619
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
-8.798225459016345
]
}
},
{
"type": "Feature",
"properties": {},
Expand Down
33 changes: 0 additions & 33 deletions packages/turf-kinks/test/out/triple.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,6 @@
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
-7.5
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
-2.5
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-45,
2.5
]
}
},
{
"type": "Feature",
"properties": {},
Expand Down

0 comments on commit f516639

Please sign in to comment.