diff --git a/dist/Triangulate.js b/dist/Triangulate.js index df3f636..ee225ec 100644 --- a/dist/Triangulate.js +++ b/dist/Triangulate.js @@ -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]), diff --git a/package.json b/package.json index 5a8cae0..d6b3484 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Triangulate.js b/src/Triangulate.js index 086986d..33cc605 100644 --- a/src/Triangulate.js +++ b/src/Triangulate.js @@ -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]),