LibNoise.Perlin.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( double x, double y, double z ) : double
x double
y double
z double
return double
        public double GetValue(double x, double y, double z)
        {
            double value = 0.0;
            double signal = 0.0;
            double curPersistence = 1.0;
            //double nx, ny, nz;
            long seed;

            x*=Frequency;
            y*=Frequency;
            z*=Frequency;

            for(int currentOctave = 0; currentOctave < OctaveCount; currentOctave++)
            {
                seed = (Seed + currentOctave) & 0xffffffff;
                /*nx = Math.MakeInt32Range(x);
                ny = Math.MakeInt32Range(y);
                nz = Math.MakeInt32Range(z);*/
                signal = NMath.GradientCoherentNoise(x, y, z, (int)seed, NoiseQuality);
                //signal = cachedNoise3(x, y, z);

                value += signal * curPersistence;

                x *= Lacunarity;
                y *= Lacunarity;
                z *= Lacunarity;
                curPersistence *= Persistence;
            }

            return value;
        }

Usage Example

 public override void Setup()
 {
     double xoff = 0;
     Perlin rnd = new Perlin();
     for (int i = 0; i < 100; i++)
     {
         double yoff = 0;
         for (int j = 0; j <100; j++)
         {
             circ.Add(new Circle(new Point3d(i, j, 0), rnd.GetValue(xoff, yoff, 0) * -1));
             //RhinoApp.WriteLine(String.Format("{0}", circ[j].Radius));
             yoff += 0.01;
         }
         xoff += 0.01;
     }
 }
All Usage Examples Of LibNoise.Perlin::GetValue