public void orizzonte7( double delta, int quadrata, double beta, double alfa, RandomIter elevImageIterator,
            WritableRaster curvatureImage, int[][] shadow ) {
        int rows = curvatureImage.getHeight();
        int cols = curvatureImage.getWidth();
        /*=====================*/

        int y, I, J;
        double zenith;

        /*======================*/

        for( int i = quadrata - 1; i >= 0; i-- ) {
            I = -1;
            J = -1;
            y = 0;
            for( int ii = i; ii < quadrata - 1; ii++ ) {
                for( int j = (int) floor(1 / tan(beta) * (ii - i)); j <= (int) floor(1 / tan(beta) * (ii - i + 1)) - 1
                        && j < cols; j++ ) {
                    if (ii >= (rows + 2 * cols) && !isNovalue(elevImageIterator.getSampleDouble(j, ii - (rows + 2 * cols), 0))) {
                        /*shadow.element[ii-(Z0.nrh+2*Z0.nch)][j]=i;}}}}*/
                        if (curvatureImage.getSampleDouble(j, ii - (rows + 2 * cols), 0) == 1 && I == -1) {
                            I = ii - (rows + 2 * cols);
                            J = j;
                            y = 1;
                        } else if (curvatureImage.getSampleDouble(j, ii - (rows + 2 * cols), 0) == 1 && I != -1) {
                            zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(j, ii
                                    - (rows + 2 * cols), 0))
                                    / sqrt(pow((double) (I - (ii - (rows + 2 * cols))) * (double) delta, (double) 2)
                                            + pow((double) (J - j) * (double) delta, (double) 2));
                            if (zenith <= tan(alfa)) {
                                shadow[ii - (rows + 2 * cols)][j] = 0;
                                I = ii - (rows + 2 * cols);
                                J = j;
                            } else {
                                shadow[ii - (rows + 2 * cols)][j] = 1;
                            }
                        } else if (curvatureImage.getSampleDouble(j, ii - (rows + 2 * cols), 0) == 0 && y == 1) {
                            zenith = (elevImageIterator.getSampleDouble(J, I, 0) - elevImageIterator.getSampleDouble(j, ii
                                    - (rows + 2 * cols), 0))
                                    / sqrt(pow((double) (I - (ii - (rows + 2 * cols))) * (double) delta, (double) 2)
                                            + pow((double) (J - j) * (double) delta, (double) 2));
                            if (zenith <= tan(alfa)) {
                                shadow[ii - (rows + 2 * cols)][j] = 0;
                                y = 0;
                            } else {
                                shadow[ii - (rows + 2 * cols)][j] = 1;
                            }
                        }
                    }
                }
            }
        }

    }
public void orizzonte7 ( double delta , int quadrata , double beta , double alfa , RandomIter elevImageIterator , WritableRaster curvatureImage , int [ ] [ ] shadow ) { int rows = curvatureImage . getHeight ( ) ; int cols = curvatureImage . getWidth ( ) ; int y , I , J ; double zenith ; for ( int i = quadrata - 1 ; i >= 0 ; i -- ) { I = - 1 ; J = - 1 ; y = 0 ; for ( int ii = i ; ii < quadrata - 1 ; ii ++ ) { for ( int j = ( int ) floor ( 1 / tan ( beta ) * ( ii - i ) ) ; j <= ( int ) floor ( 1 / tan ( beta ) * ( ii - i + 1 ) ) - 1 && j < cols ; j ++ ) { if ( ii >= ( rows + 2 * cols ) && ! isNovalue ( elevImageIterator . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) ) ) { if ( curvatureImage . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) == 1 && I == - 1 ) { I = ii - ( rows + 2 * cols ) ; J = j ; y = 1 ; } else if ( curvatureImage . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) == 1 && I != - 1 ) { zenith = ( elevImageIterator . getSampleDouble ( J , I , 0 ) - elevImageIterator . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) ) / sqrt ( pow ( ( double ) ( I - ( ii - ( rows + 2 * cols ) ) ) * ( double ) delta , ( double ) 2 ) + pow ( ( double ) ( J - j ) * ( double ) delta , ( double ) 2 ) ) ; if ( zenith <= tan ( alfa ) ) { shadow [ ii - ( rows + 2 * cols ) ] [ j ] = 0 ; I = ii - ( rows + 2 * cols ) ; J = j ; } else { shadow [ ii - ( rows + 2 * cols ) ] [ j ] = 1 ; } } else if ( curvatureImage . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) == 0 && y == 1 ) { zenith = ( elevImageIterator . getSampleDouble ( J , I , 0 ) - elevImageIterator . getSampleDouble ( j , ii - ( rows + 2 * cols ) , 0 ) ) / sqrt ( pow ( ( double ) ( I - ( ii - ( rows + 2 * cols ) ) ) * ( double ) delta , ( double ) 2 ) + pow ( ( double ) ( J - j ) * ( double ) delta , ( double ) 2 ) ) ; if ( zenith <= tan ( alfa ) ) { shadow [ ii - ( rows + 2 * cols ) ] [ j ] = 0 ; y = 0 ; } else { shadow [ ii - ( rows + 2 * cols ) ] [ j ] = 1 ; } } } } } } }
/*----------------------------------------------------------------------------------------------------------