qrohlf / trianglify

Algorithmically generated triangle art
http://qrohlf.com/trianglify/
GNU General Public License v3.0
10.08k stars 669 forks source link

Extract point generation #57

Closed enzuguri closed 8 years ago

enzuguri commented 8 years ago

Enables specifying a custom array of points (see the custom-points-example.html) for users who may want to provide their own point generation.

Additionally, I refactored the code required to generate points to inline the _map function for performance reasons, this jsbin highlights the difference: http://jsbin.com/helihu/4/edit?js,output

One of these commits includes a test to validate that the optimization produces the same result, it is then subsequently removed in a further commit. I leave this in the history in case a re-validation is required.

qrohlf commented 8 years ago

just FYI this hasn't dropped off my radar, hoping to get around to reviewing it soon!

qrohlf commented 8 years ago

@enzuguri looks great, and that performance improvement is HUGE. Thanks a ton for this.

nadbm commented 8 years ago

@qrohlf This feature is in the master branch, but the version and npm doesn't reflect this. Any plans to do this soon? Thanks!

qrohlf commented 8 years ago

@nadbm @enzuguri @flexzuu heads-up that this is finally released in v1.0.1.

enzuguri commented 8 years ago

Awesome, thanks! I have two more branches I'm toying with, one speeds up generating triangles, and one allows a custom render function (with a d3 example). Hope to have some more PR's for you when life allows.