Core 1.0
DiscTileLinked Class Reference

This class implements a Poisson disc tile structure with topological information between discs, with various generation algorithms. More...

#include <sampling.h>

Inheritance diagram for DiscTileLinked:
DiscTile

Public Member Functions

Vector2 NextVertex (int, int) const
 Return the position of the j-th vertex linked to vertex i.
QPoint Next (int, int) const
 Return the indexes defining the j-th vertex linked to vertex i.
int Valence (int) const
 Return the valence of the disc.
QString GetCode () const
 Get the code of the tile.
int Memory () const
 Get the code of the tile.
Public Member Functions inherited from DiscTile
 DiscTile ()
 Empty.
 DiscTile (const double &, const double &, const QVector< Vector2 > &)
 Create a Poisson disc sampling over a square domain.
 DiscTile (const double &, const double &, int, Random &=Random::R239)
 Create a poisson sampling in a square domain.
 DiscTile (const double &, const double &, int, const QVector< Vector2 > &, Random &=Random::R239)
 Create a poisson sampling in a square domain.
 ~DiscTile ()
 Empty.
void Relaxation (const double &=1.0/4.0)
 Perform a relaxation step over the Poisson-Disc distribution.
void Relaxation (int, const double &=1.0/4.0)
 Perform a relaxation step over the Poisson-Disc distribution.
void Scramble ()
 Scramble the points inside the generated tile.
void Draw (QGraphicsScene &) const
 Draw the distribution.
Box2 GetBox () const
 Return the box.
double Radius () const
 Return the radius.
Vector2 Vertex (int) const
 Getter on the i-th sample.
Vector2 Vertex (int, int, int) const
 Compute the i-th sample for a displaced tile.
Vector2 Vertex (const QPoint &, int) const
 Compute the i-th sample for a displaced tile.
const QVector< Vector2GetSet () const
 Return the vector containing the samples.
int Size () const
 Return the number of samples.
void Scale (const double &)
 Scale a disc tile.
QVector< Vector2Sample (const Box2 &, double(*)(const Vector2 &)) const
 Sample a domain according to an input importance function.
QVector< Vector2Sample (const ScalarField2 &) const
 Sample a domain according to an input importance function.
QVector< Vector2Sample (const Box2 &) const
 Sample a domain according to an input importance function.
double Packing () const
 Compute the packing density.
QString GetCode () const
 Get the code of the tile.
int Memory () const
 Get the code of the tile.

Protected Member Functions

void TrucMuch (const Box2 &, QVector< Vector2 > &q, QVector< QPoint > &refs) const
 Compute the set of points in the one-neighborhood of the tile that also lie inside the argument box.
Protected Member Functions inherited from DiscTile
void Generate (int, Random &=Random::R239)
 Generate the poisson sampling of the domain.
bool Intersect (const Vector2 &, bool=true) const
 Check if a disc intersect existing discs inside the tile, with or without toric constraints.

Protected Attributes

QVector< DiscLink > topo
 Topology.
Protected Attributes inherited from DiscTile
double s = 0.0
 Size.
double r = 0.0
 Radius.
double e = 0.0
 Squared radius with small epsilon tolerance.
QVector< Vector2p
 Set of samples.

Static Protected Attributes

static const QPoint next [9] = { QPoint(1,0),QPoint(1,1),QPoint(0,1),QPoint(-1,1),QPoint(-1,0),QPoint(-1,-1),QPoint(0,-1),QPoint(1,-1),QPoint(0,0) }
 Neigboring cells, including self.
static const Vector2 nextvector [9] = { Vector2(1,0), Vector2(1,1),Vector2(0,1),Vector2(-1,1),Vector2(-1,0),Vector2(-1,-1),Vector2(0,-1),Vector2(1,-1),Vector2(0,0) }
 Offset vectors for neigboring cells, including self.

Additional Inherited Members

Static Public Member Functions inherited from DiscTile
static bool Check (const Vector2 &, const QVector< Vector2 > &, double)
 Performs a Poisson disc check on a set of point and a candidate position.
Static Public Attributes inherited from DiscTile
static const DiscTile T619
 Reference unit box tiles with 231 and 619 discs.

Detailed Description

This class implements a Poisson disc tile structure with topological information between discs, with various generation algorithms.

Member Function Documentation

◆ Next()

QPoint DiscTileLinked::Next ( int i,
int j ) const

Return the indexes defining the j-th vertex linked to vertex i.

Parameters
iVertex in the tile.
jLink.
Returns
A QPoint with first coordinate set as the vertex index, and second coordinate as the cell.

◆ NextVertex()

Vector2 DiscTileLinked::NextVertex ( int i,
int j ) const

Return the position of the j-th vertex linked to vertex i.

Parameters
iVertex in the tile.
jLink.

◆ TrucMuch()

void DiscTileLinked::TrucMuch ( const Box2 & box,
QVector< Vector2 > & q,
QVector< QPoint > & refs ) const
protected

Compute the set of points in the one-neighborhood of the tile that also lie inside the argument box.

Parameters
boxThe box.
qReturned set of points.
refsReturned set of references, index and cell.

◆ Valence()

int DiscTileLinked::Valence ( int i) const

Return the valence of the disc.

Parameters
iIndex of the disc in the tile.