Panda3D
Public Member Functions | List of all members
PerlinNoise2 Class Reference

This class provides an implementation of Perlin noise for 2 variables. More...

#include "perlinNoise2.h"

Inheritance diagram for PerlinNoise2:
PerlinNoise

Public Member Functions

 PerlinNoise2 ()
 Randomizes the tables to make a unique noise function. More...
 
 PerlinNoise2 (double sx, double sy, int table_size=256, unsigned long seed=0)
 Randomizes the tables to make a unique noise function. More...
 
 PerlinNoise2 (const PerlinNoise2 &copy)
 Makes an exact copy of the existing PerlinNoise object, including its random seed. More...
 
double noise (double x, double y) const
 Returns the noise function of the three inputs. More...
 
float noise (const LVecBase2f &value) const
 Returns the noise function of the three inputs. More...
 
double noise (const LVecBase2d &value) const
 Returns the noise function of the three inputs. More...
 
double operator() (double x, double y) const
 Returns the noise function of the two inputs. More...
 
float operator() (const LVecBase2f &value) const
 Returns the noise function of the two inputs. More...
 
double operator() (const LVecBase2d &value) const
 Returns the noise function of the two inputs. More...
 
void operator= (const PerlinNoise2 &copy)
 Makes an exact copy of the existing PerlinNoise object, including its random seed. More...
 
void set_scale (double scale)
 Changes the scale (frequency) of the noise. More...
 
void set_scale (double sx, double sy)
 Changes the scale (frequency) of the noise. More...
 
void set_scale (const LVecBase2f &scale)
 Changes the scale (frequency) of the noise. More...
 
void set_scale (const LVecBase2d &scale)
 Changes the scale (frequency) of the noise. More...
 
- Public Member Functions inherited from PerlinNoise
unsigned long get_seed ()
 Returns a unique seed value based on the seed value passed to this PerlinNoise object (and on its current state). More...
 

Detailed Description

This class provides an implementation of Perlin noise for 2 variables.

This code is loosely based on the reference implementation at http://mrl.nyu.edu/~perlin/noise/ .

Definition at line 25 of file perlinNoise2.h.

Constructor & Destructor Documentation

◆ PerlinNoise2() [1/3]

PerlinNoise2::PerlinNoise2 ( )
inline

Randomizes the tables to make a unique noise function.

Uses a default scale (noise frequency), table size, and seed.

Definition at line 19 of file perlinNoise2.I.

◆ PerlinNoise2() [2/3]

PerlinNoise2::PerlinNoise2 ( double  sx,
double  sy,
int  table_size = 256,
unsigned long  seed = 0 
)
inlineexplicit

Randomizes the tables to make a unique noise function.

If seed is nonzero, it is used to define the tables; if it is zero a random seed is generated.

Definition at line 33 of file perlinNoise2.I.

References set_scale().

◆ PerlinNoise2() [3/3]

PerlinNoise2::PerlinNoise2 ( const PerlinNoise2 copy)
inline

Makes an exact copy of the existing PerlinNoise object, including its random seed.

Definition at line 46 of file perlinNoise2.I.

Member Function Documentation

◆ noise() [1/3]

double PerlinNoise2::noise ( double  x,
double  y 
) const
inline

Returns the noise function of the three inputs.

Definition at line 100 of file perlinNoise2.I.

Referenced by noise(), operator()(), and PNMImage::perlin_noise_fill().

◆ noise() [2/3]

float PerlinNoise2::noise ( const LVecBase2f &  value) const
inline

Returns the noise function of the three inputs.

Definition at line 108 of file perlinNoise2.I.

References noise().

◆ noise() [3/3]

double PerlinNoise2::noise ( const LVecBase2d &  value) const

Returns the noise function of the three inputs.

Definition at line 21 of file perlinNoise2.cxx.

◆ operator()() [1/3]

double PerlinNoise2::operator() ( double  x,
double  y 
) const
inline

Returns the noise function of the two inputs.

Definition at line 116 of file perlinNoise2.I.

References noise().

◆ operator()() [2/3]

float PerlinNoise2::operator() ( const LVecBase2f &  value) const
inline

Returns the noise function of the two inputs.

Definition at line 124 of file perlinNoise2.I.

References noise().

◆ operator()() [3/3]

double PerlinNoise2::operator() ( const LVecBase2d &  value) const
inline

Returns the noise function of the two inputs.

Definition at line 132 of file perlinNoise2.I.

References noise().

◆ operator=()

void PerlinNoise2::operator= ( const PerlinNoise2 copy)
inline

Makes an exact copy of the existing PerlinNoise object, including its random seed.

Definition at line 58 of file perlinNoise2.I.

◆ set_scale() [1/4]

void PerlinNoise2::set_scale ( double  scale)
inline

Changes the scale (frequency) of the noise.

Definition at line 68 of file perlinNoise2.I.

Referenced by PerlinNoise2(), and set_scale().

◆ set_scale() [2/4]

void PerlinNoise2::set_scale ( double  sx,
double  sy 
)
inline

Changes the scale (frequency) of the noise.

Definition at line 76 of file perlinNoise2.I.

References set_scale().

◆ set_scale() [3/4]

void PerlinNoise2::set_scale ( const LVecBase2f &  scale)
inline

Changes the scale (frequency) of the noise.

Definition at line 84 of file perlinNoise2.I.

References set_scale().

◆ set_scale() [4/4]

void PerlinNoise2::set_scale ( const LVecBase2d &  scale)
inline

Changes the scale (frequency) of the noise.

Definition at line 92 of file perlinNoise2.I.


The documentation for this class was generated from the following files: