Core 1.0
|
Poisson tiling. More...
#include <sampling.h>
Public Member Functions | |
DiscTile () | |
Empty. More... | |
DiscTile (const double &, const double &, int, Random &=Random::R239) | |
Create a poisson sampling in a square domain. More... | |
DiscTile (const double &, const double &, int, const QVector< Vector2 > &, Random &=Random::R239) | |
Create a poisson sampling in a square domain. More... | |
~DiscTile () | |
Empty. | |
void | Relaxation () |
Perform a relaxation step over the Poisson-Disc distribution. | |
void | Scramble () |
Scramble the points inside the generated tile. More... | |
void | Draw (QGraphicsScene &) const |
Draw the distribution. More... | |
Box2 | GetBox () const |
Return the box. | |
Vector2 | Vertex (int) const |
Getter on the i-th sample. More... | |
Vector2 | Vertex (int, int, int) const |
Compute the i-th sample for a displaced tile. More... | |
const QVector< Vector2 > | GetSet () const |
Return the vector containing the samples. | |
int | Size () const |
Return the number of samples. | |
QVector< Vector2 > | Sample (const Box2 &, double(*)(const Vector2 &)) const |
Sample a domain according to an input importance function. More... | |
QVector< Vector2 > | Sample (const ScalarField2 &) const |
Sample a domain according to an input importance function. More... | |
QVector< Vector2 > | Sample (const Box2 &) const |
Sample a domain according to an input importance function. More... | |
Static Public Member Functions | |
static bool | Check (const Vector2 &, const QVector< Vector2 > &, double) |
Performs a Poisson disc check on a set of point and a candidate position. More... | |
Protected Member Functions | |
void | Generate (int, Random &=Random::R239) |
Generate the poisson sampling of the domain. More... | |
bool | Intersect (const Vector2 &, bool=true) const |
Check if a disc intersect existing discs inside the tile, with or without toric constraints. More... | |
Protected Attributes | |
double | s = 0.0 |
Size. | |
double | r = 0.0 |
Radius. | |
double | e = 0.0 |
Squared radius with small epsilon tolerance. | |
QVector< Vector2 > | p |
Set of samples. | |
Poisson tiling.
Can be used for importance sampling from Template Poisson disk tiles, Ares Lagae, Philip Dutré. See Ares Lagae, Philip Dutré. A procedural object distribution function. ACM Transactions on Graphics. <BF>24</BF>(4), 1442–1461.
|
explicit |
Empty.
Initialize a poisson disc tiling.
|
explicit |
Create a poisson sampling in a square domain.
s | Size of the side of the square. |
r | Radius of the samples. |
n | Maximum number of samples in the dart throwing process. Note that the number of samples will be different. |
ra | Random number generator. |
|
explicit |
Create a poisson sampling in a square domain.
s | Size of the side of the square. |
r | Radius of the samples. |
n | Maximum number of samples in the dart throwing process. Note that the number of samples will be different. |
p | Set of samples that will be in the tile. |
ra | Random number generator. |
Performs a Poisson disc check on a set of point and a candidate position.
Returns true if the candidate intersects with the distribution, false otherwise.
p | Candidate position. |
s | Set of point. |
r | Poisson disc radius. |
void DiscTile::Draw | ( | QGraphicsScene & | scene | ) | const |
Draw the distribution.
scene | The graphics scene. |
|
protected |
Generate the poisson sampling of the domain.
n | Number of darts thrown on the domain. Note that the number of generated samples will be less than n. |
random | Random number generator. |
|
protected |
Check if a disc intersect existing discs inside the tile, with or without toric constraints.
This function performs in O(n) and is thus quite expensive should it be called many times.
q | Point. |
t | Toric constraint, set to true as default. |
Sample a domain according to an input importance function.
box | The box. |
Sample a domain according to an input importance function.
b | The box. |
f | Importance function. |
QVector< Vector2 > DiscTile::Sample | ( | const ScalarField2 & | s | ) | const |
Sample a domain according to an input importance function.
b | The box. |
s | Scalar field definin the importance function. |
void DiscTile::Scramble | ( | ) |
Scramble the points inside the generated tile.
Use a modified version of the Fisher–Yates algorithm.
|
inline |
Getter on the i-th sample.
i | Sample index. |
|
inline |
Compute the i-th sample for a displaced tile.
i | Sample index. |
x,y | Integer coordinates of the tile |