public float noise3(float x, float y, float z) {
        int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
        float rx0, rx1, ry0, ry1, rz0, rz1, q[], sy, sz, a, b, c, d, t, u, v;
        int i, j;

        if (start) {
            start = false;
            init();
        }

        t = x + N;
        bx0 = ((int) t) & BM;
        bx1 = (bx0 + 1) & BM;
        rx0 = t - (int) t;
        rx1 = rx0 - 1.0f;

        t = y + N;
        by0 = ((int) t) & BM;
        by1 = (by0 + 1) & BM;
        ry0 = t - (int) t;
        ry1 = ry0 - 1.0f;

        t = z + N;
        bz0 = ((int) t) & BM;
        bz1 = (bz0 + 1) & BM;
        rz0 = t - (int) t;
        rz1 = rz0 - 1.0f;

        i = p[bx0];
        j = p[bx1];

        b00 = p[i + by0];
        b10 = p[j + by0];
        b01 = p[i + by1];
        b11 = p[j + by1];

        t = sCurve(rx0);
        sy = sCurve(ry0);
        sz = sCurve(rz0);

        q = g3[b00 + bz0];
        u = rx0 * q[0] + ry0 * q[1] + rz0 * q[2];
        q = g3[b10 + bz0];
        v = rx1 * q[0] + ry0 * q[1] + rz0 * q[2];
        a = lerp(t, u, v);

        q = g3[b01 + bz0];
        u = rx0 * q[0] + ry1 * q[1] + rz0 * q[2];
        q = g3[b11 + bz0];
        v = rx1 * q[0] + ry1 * q[1] + rz0 * q[2];
        b = lerp(t, u, v);

        c = lerp(sy, a, b);

        q = g3[b00 + bz1];
        u = rx0 * q[0] + ry0 * q[1] + rz1 * q[2];
        q = g3[b10 + bz1];
        v = rx1 * q[0] + ry0 * q[1] + rz1 * q[2];
        a = lerp(t, u, v);

        q = g3[b01 + bz1];
        u = rx0 * q[0] + ry1 * q[1] + rz1 * q[2];
        q = g3[b11 + bz1];
        v = rx1 * q[0] + ry1 * q[1] + rz1 * q[2];
        b = lerp(t, u, v);

        d = lerp(sy, a, b);

        return 1.5f * lerp(sz, c, d);
    }
public float noise3 ( float x , float y , float z ) { int bx0 , bx1 , by0 , by1 , bz0 , bz1 , b00 , b10 , b01 , b11 ; float rx0 , rx1 , ry0 , ry1 , rz0 , rz1 , q [ ] , sy , sz , a , b , c , d , t , u , v ; int i , j ; if ( start ) { start = false ; init ( ) ; } t = x + N ; bx0 = ( ( int ) t ) & BM ; bx1 = ( bx0 + 1 ) & BM ; rx0 = t - ( int ) t ; rx1 = rx0 - 1.0f ; t = y + N ; by0 = ( ( int ) t ) & BM ; by1 = ( by0 + 1 ) & BM ; ry0 = t - ( int ) t ; ry1 = ry0 - 1.0f ; t = z + N ; bz0 = ( ( int ) t ) & BM ; bz1 = ( bz0 + 1 ) & BM ; rz0 = t - ( int ) t ; rz1 = rz0 - 1.0f ; i = p [ bx0 ] ; j = p [ bx1 ] ; b00 = p [ i + by0 ] ; b10 = p [ j + by0 ] ; b01 = p [ i + by1 ] ; b11 = p [ j + by1 ] ; t = sCurve ( rx0 ) ; sy = sCurve ( ry0 ) ; sz = sCurve ( rz0 ) ; q = g3 [ b00 + bz0 ] ; u = rx0 * q [ 0 ] + ry0 * q [ 1 ] + rz0 * q [ 2 ] ; q = g3 [ b10 + bz0 ] ; v = rx1 * q [ 0 ] + ry0 * q [ 1 ] + rz0 * q [ 2 ] ; a = lerp ( t , u , v ) ; q = g3 [ b01 + bz0 ] ; u = rx0 * q [ 0 ] + ry1 * q [ 1 ] + rz0 * q [ 2 ] ; q = g3 [ b11 + bz0 ] ; v = rx1 * q [ 0 ] + ry1 * q [ 1 ] + rz0 * q [ 2 ] ; b = lerp ( t , u , v ) ; c = lerp ( sy , a , b ) ; q = g3 [ b00 + bz1 ] ; u = rx0 * q [ 0 ] + ry0 * q [ 1 ] + rz1 * q [ 2 ] ; q = g3 [ b10 + bz1 ] ; v = rx1 * q [ 0 ] + ry0 * q [ 1 ] + rz1 * q [ 2 ] ; a = lerp ( t , u , v ) ; q = g3 [ b01 + bz1 ] ; u = rx0 * q [ 0 ] + ry1 * q [ 1 ] + rz1 * q [ 2 ] ; q = g3 [ b11 + bz1 ] ; v = rx1 * q [ 0 ] + ry1 * q [ 1 ] + rz1 * q [ 2 ] ; b = lerp ( t , u , v ) ; d = lerp ( sy , a , b ) ; return 1.5f * lerp ( sz , c , d ) ; }
Compute 3-dimensional Perlin noise.

@param x the x coordinate
@param y the y coordinate
@param y the y coordinate
@return noise value at (x,y,z)