diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..129e420 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +tmp +*.log +yarn.lock diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6f4f868 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2017, Mapbox + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d277085 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +## delaunator + +The fastest JavaScript library for +[Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) of 2D points. + +A work in progress. diff --git a/index.js b/index.js index 1d948e4..fbdd94d 100644 --- a/index.js +++ b/index.js @@ -185,16 +185,16 @@ Delaunay.prototype = { var p0 = triangles[ar]; var pr = triangles[a]; var pl = triangles[al]; - var p = triangles[bl]; + var p1 = triangles[bl]; var illegal = inCircle( coords[p0], coords[p0 + 1], coords[pr], coords[pr + 1], coords[pl], coords[pl + 1], - coords[p], coords[p + 1]); + coords[p1], coords[p1 + 1]); if (illegal) { - triangles[a] = p; + triangles[a] = p1; triangles[b] = p0; this._link(a, adjacent[bl]);