1.0.4 • Published 3 years ago

weighted-voronoi-stippling v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

weighted_voronoi_stippling

A Javascript implementation of Weighted Voronoi Stippling by Adrian Secord

The pixel values are used as density. First points are seeded with rejection sampling. Then a voronoi diagram is generated with the points. The centroids of each voronoi region is computed with density, and the points are moved to the centroid locations. This above two steps are repeated until convergence.

The voronoi diagram is drawn with WebGl.

Usage

// generates an array of points from the image
const samples = generateStipples(image, {sampleTimes: 20000, maxIteration: 20, convergeThreshold: 0.2});

Options

sampleTimes

The number of times to sample in the initial seeding stage.

chanel

The chanel of the image to sample with. Should be one of 'r', 'g', 'b', 'a', 'avg'.

convergeThreshold

If the max difference in length between points and their corresponding centroids falls below the convergeThreshold, the process stops.

maxIteration

If the iteration times reach this number, the process stops.

1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago