Пример #1
0
        /* Noise helper functions. */
        // added types 3,4,5,6 including stripes2, stripes3 functions(cos stripes)
        private double F(double x, double y, double z, int type)
        {
            double w = this.Scene.DefaultCamera.ResX;

            switch (type)
            {
            case 1:
                return(.03 * PerlinNoiseFilter.Noise(x, y, z, 15));

            case 2:
                return(.01 * PerlinNoiseFilter.Stripes(x + 2 * PerlinNoiseFilter.Turbulence(x, y, z, w, 1), 1.6));

            case 3:
                return(.04 * PerlinNoiseFilter.Stripes2(x + 1.5 * PerlinNoiseFilter.Turbulence(x, y, z, w, 1), 1.6));

            case 4:
                return(.03 * PerlinNoiseFilter.Stripes(PerlinNoiseFilter.Noise(x, y, z, 5), 5));

            case 5:
                //return .05 * PerlinNoiseFilter.Turbulence(
                //    PerlinNoiseFilter.Noise(x, y, z, 2),
                //    PerlinNoiseFilter.Noise(x, y, z, 2),
                //    PerlinNoiseFilter.Noise(x, y, z, 2), w, 5);
                //return .05 *
                //    PerlinNoiseFilter.Noise((float)Math.Cos(x * Math.PI), y, z, 10) *
                //    PerlinNoiseFilter.Noise(x, (float)Math.Cos(y * Math.PI), z, 10) *
                //    PerlinNoiseFilter.Noise(x, y, (float)Math.Cos(z * Math.PI), 10);
                return(.03 * Math.Cos(PerlinNoiseFilter.Noise(x, y, z)));

            //return .01 * PerlinNoiseFilter.Stripes(x + 2 * PerlinNoiseFilter.Turbulence(x, y, z, w, 1), 1.6);
            //return 0.05 * PerlinNoiseFilter.Stripes3(x - PerlinNoiseFilter.Noise(x, y, z, 1), z - PerlinNoiseFilter.Turbulence(x, y, z, w, 1));
            case 6:
                return(-.10 *
                       PerlinNoiseFilter.Turbulence(
                           x - PerlinNoiseFilter.Stripes(PerlinNoiseFilter.Noise(x, y, z, 5), 5),
                           y - PerlinNoiseFilter.Stripes(PerlinNoiseFilter.Noise(x, y, z, 5), 5),
                           z - PerlinNoiseFilter.Stripes(PerlinNoiseFilter.Noise(x, y, z, 5), 5), w, 10));

            case 7:
                return(.04 * PerlinNoiseFilter.Stripes3(x + 2 * PerlinNoiseFilter.Turbulence(x, y, z, w, 1), 1.6));

            default:
                return(-.10 * PerlinNoiseFilter.Turbulence(x, y, z, w, 1));
            }
        }
Пример #2
0
 private void TestPerlinNoise_DoubleClick(object sender, EventArgs e)
 {
     this.textBox1.Text = PerlinNoiseFilter.Noise(50, 50, 50).ToString();
 }