News for hackers. Stuff that matters.
Re:Show HN: Kubist, a little web app to make cubism-like images by d55 on Monday April 20, 2015 @04:28PM (#9410684)
I failed in doing something very similar. Could you explain how you split the image up into triangles?
Re:Show HN: Kubist, a little web app to make cubism-like images by dsp1234 on Monday April 20, 2015 @04:32PM (#9410703)
There is a link at the bottom of the page that links to https://medium.com/@williamngan/kubist-6ed1d8025806 which appears to be an explanation on how it works.
Re:Show HN: Kubist, a little web app to make cubism-like images by lelandbatey on Monday April 20, 2015 @04:43PM (#9410757)
In the demo there's also a second mode called "Cell" that seems reminiscent of sampling via Poisson Disc, which you can read more about in Mike Bostock's excellent "Visualizing Algorithms" post.[0]

[0] - http://bost.ocks.org/mike/algorithms/

Re:Show HN: Kubist, a little web app to make cubism-like images by metaphorical on Monday April 20, 2015 @05:31PM (#9410992)
Yep, both delaunay ("Triangle") and voronoi ("Cell") uses "best candidate algorithm" to distribute the points by default. It's similiar to poisson disc.

The "Analyze image" uses JSFeat to apply a computer vision algorithm (feature point detection) to add some "interesting" points based on the image.

Re:Show HN: Kubist, a little web app to make cubism-like images by metaphorical on Monday April 20, 2015 @05:27PM (#9410974)
Yes. I use d3.geom.delaunay or d3.geom.voronoi to create the delaunay or voronoi tessellation.

http://bl.ocks.org/mbostock/4341156

Then for each polygon, I take its points (center point or vertices or an arbitrary point) and find the corresponding pixel on the image. Then I extract the rgb color, and use that to fill the polygon (as solid color or gradient).