Core 1.0
DiscTileCorner Class Reference

Poisson disc sampling with sixteen tiles and aperiodic tiling. More...

#include <sampling.h>

Public Member Functions

 DiscTileCorner (const double &, const double &, int, Random &=Random::R239)
 Create a Poisson sampling in a square domain.
 ~DiscTileCorner ()
 Empty.
Box2 GetBox () const
 Return the box.
Vector2 Vertex (int, int) const
 Getter on the i-th sample.
Vector2 Vertex (int, int, int) const
 Compute the i-th sample for a displaced tile.
int Size (int) const
 Return the number of samples.
double SideLength () const
 Return the side length of the tile.
double Radius () const
 Return the radius of particles.
QVector< Vector2 > Sample (const ScalarField2 &) const
 Sample a domain according to an input importance function.
QVector< Vector2 > Sample (const Box2 &) const
 Sample a box by tiling the domain with the tiles of the set.
DiscTile Get (int) const
 Return the i-th disc tile.
double Packing () const
 Compute the average packing density.
int Select (int, int) const
 Tile selection.

Protected Attributes

double s = 0.0
 Size.
double r = 0.0
 Radius.
double e = 0.0
 Squared radius with small epsilon tolerance.
DiscTile tiles [16]
 Tiles.

Detailed Description

Poisson disc sampling with sixteen tiles and aperiodic tiling.

Tiles are created using the Corner Cube algorithm, see:

A. Lagae, P. Dutré. An alternative for Wang tiles: colored edges versus colored corners. ACM Transactions on Graphics 25 (4), 1442-1459.

A. Lagae, P. Dutré. A procedural object distribution function. ACM Transactions on Graphics 24 (4), 2005.

Constructor & Destructor Documentation

◆ DiscTileCorner()

DiscTileCorner::DiscTileCorner ( const double & s,
const double & r,
int n,
Random & ra = Random::R239 )
explicit

Create a Poisson sampling in a square domain.

Parameters
sSize of the side of the square.
rRadius of the samples.
nMaximum number of samples in the dart throwing process. Note that the number of samples will be different.
raRandom number generator.

Member Function Documentation

◆ Packing()

double DiscTileCorner::Packing ( ) const

Compute the average packing density.

This is the mean of the packing densities of the sixteen tiles.

Returns
The packing density.
See also
DiscTile::Packing()

◆ Sample() [1/2]

QVector< Vector2 > DiscTileCorner::Sample ( const Box2 & box) const

Sample a box by tiling the domain with the tiles of the set.

The tiles are selected by the aperiodic tiling, and only the samples that lie inside the box are returned.

Parameters
boxThe box.
Returns
The set of samples.

◆ Sample() [2/2]

QVector< Vector2 > DiscTileCorner::Sample ( const ScalarField2 & s) const

Sample a domain according to an input importance function.

Parameters
sScalar field defining the importance function.

◆ Select()

int DiscTileCorner::Select ( int x,
int y ) const

Tile selection.

Parameters
x,yInteger coordinates of the tile.

◆ Size()

int DiscTileCorner::Size ( int t) const

Return the number of samples.

Parameters
tTile.

◆ Vertex() [1/2]

Vector2 DiscTileCorner::Vertex ( int t,
int i ) const

Getter on the i-th sample.

Parameters
tTile.
iSample index.

◆ Vertex() [2/2]

Vector2 DiscTileCorner::Vertex ( int x,
int y,
int i ) const

Compute the i-th sample for a displaced tile.

Parameters
iSample index, should be lower than the size of tile at (x,y).
x,yInteger coordinates of the tile.