-
Book Overview & Buying
-
Table Of Contents
Mastering openFrameworks: Creative Coding Demystified
By :
openFrameworks has a built-in implementation of simplex noise, implemented in the ofNoise( t ) function. For example, the following code draws the Perlin noise function, ofNoise( t ), for t ranging from 0 to 10 on the screen:
ofSetColor( 0, 0, 0 );
for (int x=0; x<1000; x++) {
float t = x * 0.01;
float y = ofNoise( t );
ofLine( x, 300, x, 300 - y * 300 );
}This is the example 13-PerlinNoise/01-PerlinGraph.
Run the code and you will see the following graph:

Now replace the line float y = ofNoise( t ); with the following line:
float y = ofNoise( t + 493.0 );
This code renders the noise function in the range [443, 453].

Considering the preceding graphs, you can note the following properties:
The function values are from 0 to 1, and the mean value is clearly about 0.5. Hence you can think about the noise function as describing the fluctuation of some random parameter near its center value, equal to 0.5.
These two graphs depict different ranges of t – [0, 10...
Change the font size
Change margin width
Change background colour