Web Worker implementation for stipple generation and distribution
Classes
Members
# inner constant ctx
Worker context
Methods
# inner createRandomStipples(numStipples, maxX, maxY, sampleropt) → {Array.<WorkerStipple>}
Creates random stipples within bounds
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
numStipples |
number
|
Number of stipples to create |
||
maxX |
number
|
Maximum X coordinate |
||
maxY |
number
|
Maximum Y coordinate |
||
sampler |
function
|
<optional> |
d3.randomUniform | Random number generator |
Array of randomly positioned stipples
Array.<WorkerStipple>
# inner fillStippleProperties(stipples, densityFunction) → {Array.<WorkerStipple>}
Normalizes stipple properties for visualization
Parameters:
Name | Type | Description |
---|---|---|
stipples |
Array.<WorkerStipple>
|
Stipples to process |
densityFunction |
DensityFunction2D
|
Reference density function |
Processed stipples with normalized properties
Array.<WorkerStipple>
# inner handleStippleChange(stipples, voronoi, area, error) → {Object}
Handles stipple changes based on density thresholds
Parameters:
Name | Type | Description |
---|---|---|
stipples |
Array.<WorkerStipple>
|
Current stipples |
voronoi |
Voronoi.<number>
|
Current Voronoi diagram |
area |
number
|
Target area per stipple |
error |
number
|
Error threshold |
Change status and updated stipples
Object
# inner splitCell(cell)
Splits a Voronoi cell into two points
Parameters:
Name | Type | Description |
---|---|---|
cell |
# async inner stippleDensityFunction(densityFunction, initialStippleRadius, initialErrorThreshold, thresholdConvergenceRate, maxIterations)
Main stippling algorithm Iteratively places and adjusts stipples based on density function
Parameters:
Name | Type | Description |
---|---|---|
densityFunction |
DensityFunction2D
|
Target density function |
initialStippleRadius |
number
|
Starting radius for stipples |
initialErrorThreshold |
number
|
Initial error tolerance |
thresholdConvergenceRate |
number
|
Rate of error threshold increase |
maxIterations |
number
|
Maximum number of iterations |