Core 1.0
CellularNoise2 Class Reference

Two-dimensional procedural noise using Voronoi decomposition of space. More...

#include <voronoise.h>

Inheritance diagram for CellularNoise2:
InfiniteArray AnalyticScalarField2 CellularTurbulence2

Public Member Functions

 CellularNoise2 ()
 Create a cellular noise.
virtual double Value (const Vector2 &) const
 Compute the noise at a given point.
Public Member Functions inherited from AnalyticScalarField2
 AnalyticScalarField2 (bool=true)
 Constructor.
virtual Vector2 Gradient (const Vector2 &) const
 Compute the gradient of the field.
virtual Matrix2 Hessian (const Vector2 &) const
 Compute the hessian at a given point.
virtual ScalarField2 Sample (const Array2 &) const
 Create a discrete scalar field by sampling a given domain.
bool Inside (const double &) const
 Check if the value is considered as inside or outside.
void Curvature (const Vector2 &, double &, double &) const
 Compute the gaussian and mean curvatures.
virtual Box2 GetBox () const
 Return the bounding box.

Additional Inherited Members

Protected Member Functions inherited from InfiniteArray
 InfiniteArray ()
 Constructor.
void Square (const Vector2 &, int &, int &) const
 Compute the cubic cell coordinates.
void Square (const Vector2 &, int &, int &, double &, double &) const
 Compute the local coordinates inside a cubic cell.
void Square (const Vector &, int &, int &, int &) const
 Compute the cubic cell coordinates.
void Square (const Vector &, int &, int &, int &, double &, double &, double &) const
 Compute the local coordinates inside a cubic cell.
Vector2 CellVertex (int, int) const
 Compute a random point in a cell.
Vector CellVertex (int, int, int) const
 Compute a random point in a cell.
Protected Member Functions inherited from AnalyticScalarField2
Matrix Local (const Vector2 &) const
 Compute the local neighborhood in the one-ring aroung a point.
 AnalyticScalarField2 (bool=true)
 Constructor.
virtual Vector2 Gradient (const Vector2 &) const
 Compute the gradient of the field.
virtual Matrix2 Hessian (const Vector2 &) const
 Compute the hessian at a given point.
virtual ScalarField2 Sample (const Array2 &) const
 Create a discrete scalar field by sampling a given domain.
bool Inside (const double &) const
 Check if the value is considered as inside or outside.
void Curvature (const Vector2 &, double &, double &) const
 Compute the gaussian and mean curvatures.
virtual Box2 GetBox () const
 Return the bounding box.
Protected Attributes inherited from InfiniteArray
unsigned int o = 0
 Random offset.
Protected Attributes inherited from AnalyticScalarField2
bool sign = true
 Sign convention, used for normal computation.
Box2 box = Box2::Infinity
 Domain, set as infinite for base class.
Static Protected Attributes inherited from InfiniteArray
static Xoshiro256 random
 Fast random number generator.
Static Protected Attributes inherited from AnalyticScalarField2
static const double epsilon = 1e-6
 \( \varepsilon \) value for first order partial derivatives (gradient).
static const double epsilonhessian = 1e-4
 Larger \( \varepsilon \) value for second order partial derivatives (hessian).

Detailed Description

Two-dimensional procedural noise using Voronoi decomposition of space.

The noise is a function of the distance to the nearest seed, one random seed being placed in every cell of the grid.

Member Function Documentation

◆ Value()

double CellularNoise2::Value ( const Vector2 & p) const
virtual

Compute the noise at a given point.

The value is the distance to the nearest seed, mapped linearly onto [-1,1]. The seed of the cell containing p is at most sqrt(2) away, so the value is always in [-1,1]: -1 is reached on a seed, and 1 only in the limit where the seeds of all neighbouring cells sit at the opposite corners of their cells, which has a vanishing probability. In practice values stay below about 0.67.

Parameters
pPoint.

Reimplemented from AnalyticScalarField2.

Reimplemented in CellularTurbulence2.