KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PerlinNoise Class Reference

#include <PerlinNoise.h>

Public Member Functions

 PerlinNoise ()
 Initialize with the reference values for the permutation vector.
 
 PerlinNoise (unsigned int seed)
 Generate a new permutation vector based on the value of seed.
 
float noise (float x, float y, float z) const
 
float noise (float x, float y) const
 

Private Member Functions

float fade (float t) const
 
float lerp (float t, float a, float b) const
 
float grad (int hash, float x, float y, float z) const
 
float grad (int hash, float x, float y) const
 

Private Attributes

std::vector< int > p
 

Detailed Description

Definition at line 55 of file PerlinNoise.h.

Constructor & Destructor Documentation

◆ PerlinNoise() [1/2]

PerlinNoise::PerlinNoise ( )

Initialize with the reference values for the permutation vector.

Definition at line 55 of file PerlinNoise.cpp.

References p.

◆ PerlinNoise() [2/2]

PerlinNoise::PerlinNoise ( unsigned int  seed)

Generate a new permutation vector based on the value of seed.

Definition at line 80 of file PerlinNoise.cpp.

References p.

Member Function Documentation

◆ fade()

float PerlinNoise::fade ( float  t) const
private

Definition at line 168 of file PerlinNoise.cpp.

Referenced by noise().

◆ grad() [1/2]

float PerlinNoise::grad ( int  hash,
float  x,
float  y 
) const
private

Definition at line 192 of file PerlinNoise.cpp.

◆ grad() [2/2]

float PerlinNoise::grad ( int  hash,
float  x,
float  y,
float  z 
) const
private

Definition at line 180 of file PerlinNoise.cpp.

Referenced by noise().

◆ lerp()

float PerlinNoise::lerp ( float  t,
float  a,
float  b 
) const
private

Definition at line 174 of file PerlinNoise.cpp.

Referenced by noise().

◆ noise() [1/2]

float PerlinNoise::noise ( float  x,
float  y 
) const

Definition at line 138 of file PerlinNoise.cpp.

References BA, BB, fade(), grad(), lerp(), p, res, and X.

◆ noise() [2/2]

Member Data Documentation

◆ p

std::vector<int> PerlinNoise::p
private

Definition at line 79 of file PerlinNoise.h.

Referenced by noise(), and PerlinNoise().


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