Cortex
10.0.0-a4
|
#include <PointDistribution.h>
Inherits noncopyable.
Public Member Functions | |
PointDistribution (const std::string &tileSet) | |
template<typename DensityFunction , typename PointFunction > | |
void | operator() (const Imath::Box2f &bounds, float density, DensityFunction &densitySampler, PointFunction &pointEmitter) const |
template<typename PointFunction > | |
void | operator() (const Imath::Box2f &bounds, float density, PointFunction &pointEmitter) const |
Static Public Member Functions | |
static const PointDistribution & | defaultInstance () |
An implementation of the following paper for producing nice 2d point distributions with varying density.
Recursive Wang Tiles for Real-Time Blue Noise Johannes Kopf, Daniel Cohen-Or, Oliver Deussen, Dani Lischinski In ACM Transactions on Graphics 25, 3 (Proc. SIGGRAPH 2006)
IECore::PointDistribution::PointDistribution | ( | const std::string & | tileSet | ) |
Constructor takes the filename of a tile set. We use the set found at http://johanneskopf.de/publications/blue_noise/tilesets/tileset_2048.dat
|
static |
Returns a reference to a static PointDistribution which can be shared by anyone who needs one. This distribution uses the tile set pointed to by the CORTEX_POINTDISTRIBUTION_TILESET environment variable.
void IECore::PointDistribution::operator() | ( | const Imath::Box2f & | bounds, |
float | density, | ||
DensityFunction & | densitySampler, | ||
PointFunction & | pointEmitter | ||
) | const |
Returns points in the box specified by bounds.
density specifies the number of points generated per unit area if the densitySampler always returns 1.
densitySampler must have signature float( const Imath::V2f &pos ) and return a density in the range 0-1.
pointEmitter is called for each point generated and must have the signature void( const Imath::V2f &pos ).
void IECore::PointDistribution::operator() | ( | const Imath::Box2f & | bounds, |
float | density, | ||
PointFunction & | pointEmitter | ||
) | const |
Variation on the function above for times when the density function isn't available to be evaluated on a point by point basis - perhaps because it is best evaluated in SIMD (as the IECoreRI::SXRenderer would do).
density specifies the number of points generated per unit area.
pointEmitter is called for each point generated and must have the signature void( const Imath::V2f &pos, float densityThreshold ) densityThreshold allows for deferred rejection of the points using a density function evaluated later - if the density evaluated is less than densityThreshold then that point should be rejected.