h o m e d o c u m e n t a t i o n c l a s s h i e r a r c h y

Noise.h

00001 //
00002 //  Filename         : Noise.h
00003 //  Author(s)        : Emmanuel Turquin
00004 //  Purpose          : Class to define Perlin noise
00005 //  Date of creation : 12/01/2004
00006 //
00008 
00009 
00010 //
00011 //  Copyright (C) : Please refer to the COPYRIGHT file distributed 
00012 //   with this source distribution. 
00013 //
00014 //  This program is free software; you can redistribute it and/or
00015 //  modify it under the terms of the GNU General Public License
00016 //  as published by the Free Software Foundation; either version 2
00017 //  of the License, or (at your option) any later version.
00018 //
00019 //  This program is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with this program; if not, write to the Free Software
00026 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 //
00029 
00030 #ifndef NOISE_H
00031 # define NOISE_H
00032 
00033 
00034 # include "../system/FreestyleConfig.h"
00035 # include "Geom.h"
00036 
00037 #define _Noise_B_ 0x100
00038 
00039 using namespace Geometry;
00040 using namespace std;
00041 
00043 class LIB_GEOMETRY_EXPORT Noise
00044 {
00045  public:
00046 
00048   Noise();
00050   ~Noise() {}
00051 
00053   float turbulence1(float arg, float freq, float amp, unsigned oct = 4);
00054 
00056   float turbulence2(Vec2f& v, float freq, float amp, unsigned oct = 4);
00057 
00059   float turbulence3(Vec3f& v, float freq, float amp, unsigned oct = 4);
00060 
00062   float smoothNoise1(float arg);
00064   float smoothNoise2(Vec2f& vec);
00066   float smoothNoise3(Vec3f& vec);
00067 
00068  private:
00069 
00070   int p[ _Noise_B_ + _Noise_B_ + 2];
00071   float g3[ _Noise_B_ + _Noise_B_ + 2][3];
00072   float g2[ _Noise_B_ + _Noise_B_ + 2][2];
00073   float g1[ _Noise_B_ + _Noise_B_ + 2];
00074   int start;
00075 };
00076 
00077 #endif // NOISE_H