Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

darkskyapp/delaunay-fast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is just a quick little implementation of Delaunay Triangulation in JavaScript. It was mostly ported from Paul Bourke's C implementation, but I referenced some bits from another JavaScript implementation and rewrote a bunch of things in ways more amenable to fast JavaScript execution.

Essentially, you pass Delaunay.triangulate a list of vertices (which should be a bunch of two-element arrays, representing 2D Euclidean points), and it will return you a giant array, arranged in triplets, representing triangles by indices into the passed array. (This representation is a little bizarre, but object allocation is too slow for this library's original use case. Yes, really.)

Beware of using vertices that are too close to each other (say, within 0.01 on either axis): numerical precision issues may result, causing your mesh to be invalid. (If you encounter this, simply multiply each of your vertices' positions by a constant factor.)

License

To the extent possible by law, I have waived all copyright and related or neighboring rights to this library.

Related

About

Fast Delaunay Triangulation in JavaScript.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •