Class: Stipple

Stipple()

A stipple as returned by stipple. Has a position (x, y) coordinate with respect to the dimensions of the underlying DensityFunction2D, and a density ∈ [0,1]. A stipple also has a relative position that is independent of the underlying DensityFunction2D and can be used to scale a visualization to a new resolution more easily.

Constructor

new Stipple()

Source:

Methods

(static) createRandomStipples(numStipples, xScale, yScale, sampler) → {Array.<Stipple>}

Creates an array of randomly placed stipples in a 2D region with lower bounds (0,0) and upper bounds (xScale, yScale).
Parameters:
Name Type Default Description
numStipples the number of Stipple instances to create
xScale 1 the upper bound for x coordinates of created Stipple instances
yScale 1 the upper bound for y coordinates of created Stipple instances
sampler a callable factory for creating sampling functions. Must have the signature (number, number, ...) => function. Defaults to d3.randomUniform.
Source:
Returns:
an array of randomly placed Stipple instances.
Type
Array.<Stipple>

position() → {Array.<number>}

The position of this stipple with respect to the dimensions of the DensityFunction2D it was created from.
Source:
Returns:
the position of this stipple as an array containing its x and y coordinates (i.e. [x,y])
Type
Array.<number>

setPosition(x, y)

Sets the position for this stipple based on new x and y coordinates.
Parameters:
Name Type Description
x the new x coordinate of this stipple
y the new y coordinate of this stipple
Source: