Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
SimplexNoise.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <cstddef> // size_t
13 
17 class SimplexNoise {
18 public:
19  static float simplex1(float x)
20  {
21  return noise(x*1.2, -x*0.7);
22  }
23  // 1D Perlin simplex noise
24  static float noise(float x);
25  // 2D Perlin simplex noise
26  static float noise(float x, float y);
27 
28  // Fractal/Fractional Brownian Motion (fBm) noise summation
29  float fractal(size_t octaves, float x) const;
30  float fractal(size_t octaves, float x, float y) const;
31 
40  explicit SimplexNoise(float frequency = 1.0f,
41  float amplitude = 1.0f,
42  float lacunarity = 2.0f,
43  float persistence = 0.5f) :
44  mFrequency(frequency),
45  mAmplitude(amplitude),
46  mLacunarity(lacunarity),
47  mPersistence(persistence) {
48  }
49 
50 private:
51  // Parameters of Fractional Brownian Motion (fBm) : sum of N "octaves" of noise
52  float mFrequency;
53  float mAmplitude;
54  float mLacunarity;
55  float mPersistence;
56 };
A Perlin Simplex Noise C++ Implementation (1D, 2D, 3D, 4D).
Definition: SimplexNoise.h:17
static float noise(float x)
Definition: SimplexNoise.cpp:159
SimplexNoise(float frequency=1.0f, float amplitude=1.0f, float lacunarity=2.0f, float persistence=0.5f)
Definition: SimplexNoise.h:40
float fractal(size_t octaves, float x) const
Definition: SimplexNoise.cpp:280