Skip to content

Commit

Permalink
missing isClockwise() added
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Marsch committed Apr 20, 2016
1 parent 4d6b1cd commit 8e0bccb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dist/Triangulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,12 @@ var Triangulate = {};
}
};

function isClockWise(ring) {
return 0 < ring.reduce(function(a, b, c, d) {
return a + ((c < d.length - 1) ? (d[c+1][0] - b[0]) * (d[c+1][1] + b[1]) : 0);
}, 0);
}

function process(res, id, properties, geom, position, color) {
var geometry = transform(geom, position),
bbox = getBBox(geometry[0]),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Triangulate",
"version": "0.1.2",
"version": "0.1.3",
"homepage": "http://osmbuildings.org",
"description": "GeoJSON triangulation scripts collection. Mainly used for OSM Buildings backend + frontend.",
"main": "dist/Triangulate.js",
Expand Down
6 changes: 6 additions & 0 deletions src/Triangulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ var Triangulate = {};
}
};

function isClockWise(ring) {
return 0 < ring.reduce(function(a, b, c, d) {
return a + ((c < d.length - 1) ? (d[c+1][0] - b[0]) * (d[c+1][1] + b[1]) : 0);
}, 0);
}

function process(res, id, properties, geom, position, color) {
var geometry = transform(geom, position),
bbox = getBBox(geometry[0]),
Expand Down

0 comments on commit 8e0bccb

Please sign in to comment.