Core 1.0
Noise2 Class Reference

Perlin noise. More...

#include <noise.h>

Inheritance diagram for Noise2:
AnalyticScalarField2 NoiseTurbulence2

Public Member Functions

 Noise2 (bool=false)
 Create a noise function.
 ~Noise2 ()
 Empty.
double Value (const Vector2 &) const
 Compute noise at a given point in the plane.
double K () const
 Return the global Lipschitz constant of the noise.
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.

Protected Attributes

bool quintic = false
 Flag defining interpolation type: either cubic (false) or quintic (true).
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

static double rtable [267]
 Random double table.
static const short hashTable [4096]
 Hash table.
Static Protected Attributes inherited from AnalyticScalarField2
static constexpr double epsilon = 1e-6
 \( \varepsilon \) value for first order partial derivatives (gradient).
static constexpr double epsilonhessian = 1e-4
 Larger \( \varepsilon \) value for second order partial derivatives (hessian).

Additional Inherited Members

Protected Member Functions inherited from AnalyticScalarField2
Matrix Local (const Vector2 &) const
 Compute the local neighborhood in the one-ring aroung a point.

Detailed Description

Perlin noise.

This class is used as a core class to create various types of fractal noise, such as sums of scaled noises.

See also
SimplexNoise

Constructor & Destructor Documentation

◆ Noise2()

Noise2::Noise2 ( bool quintic = false)

Create a noise function.

Parameters
quinticFlag defining whether quintic interpolation will be used, noise uses cubic interpolation if set to false.

Member Function Documentation

◆ K()

double Noise2::K ( ) const

Return the global Lipschitz constant of the noise.

The norm of the gradient of the noise has been measured numerically with finite differences over several million points, and refined around its maximum: it reaches 2.84 with the cubic interpolation and 3.47 with the quintic interpolation. The returned constant is a bound of this value, and depends on the interpolation.

◆ Value()

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

Compute noise at a given point in the plane.

Parameters
pPoint.

Reimplemented from AnalyticScalarField2.

Reimplemented in NoiseTurbulence2.