Skip to content

Instantly share code, notes, and snippets.

@gregkepler
Created November 4, 2012 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregkepler/4012083 to your computer and use it in GitHub Desktop.
Save gregkepler/4012083 to your computer and use it in GitHub Desktop.
Cinder Noise Range Test
#include "cinder/app/AppBasic.h"
#include "cinder/Perlin.h"
#include "cinder/Rand.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class NoiseRangeTest : public AppBasic {
public:
void setup();
};
void NoiseRangeTest::setup()
{
Perlin mPerlin = Perlin();
mPerlin.setSeed(clock());
float v = randFloat();
float lowest = 0.0;
float highest = 0.0;
for(int i=0; i<1000000; i++){
float n = mPerlin.fBm(v);
//float n = mPerlin.noise(v);
if(n < lowest) lowest = n;
if(n > highest) highest = n;
v+= .01;
}
console()<< lowest << " : " << highest << endl;
}
@gregkepler
Copy link
Author

Quick script to test the range of values you get from perlin noise in Cinder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment