private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
            String frek=jTextField8.getText();
            String put="C:\\Users\\vhailor\\Documents\\NetBeansProjects\\JavaApplication10\\";
            DecimalFormat f = new DecimalFormat("##");
            DecimalFormat f1 = new DecimalFormat("##.##");
            String duz1=jTextField1.getText();
            String sir1=jTextField2.getText();
            String duz2=jTextField3.getText();
            String sir2=jTextField4.getText();
            String v1=jTextField9.getText();
            String v2=jTextField10.getText();
            float visAnt1=Float.valueOf(v1);
            float visAnt2=Float.valueOf(v2);
            double du1=Double.valueOf(duz1);
            double si1=Double.valueOf(sir1);
            double du2=Double.valueOf(duz2);
            double si2=Double.valueOf(sir2);
            float antVis1=Float.valueOf(jTextField9.getText());
            float antVis2=Float.valueOf(jTextField10.getText());
            String d1=String.valueOf(f.format(Math.floor(du1)));
            String s1=String.valueOf(f.format(Math.floor(si1)));
            String d2=String.valueOf(f.format(Math.floor(du2)));
            String s2=String.valueOf(f.format(Math.floor(si2)));
            
            
            String nazivDat="";
            nazivDat+=put+"N"+d1+"E";
            if(si1<100) nazivDat+="0";
            nazivDat+=s1+".hgt";
            //File file = new File("C:\\Users\\vhailor\\Documents\\NetBeansProjects\\JavaApplication10\\N40E014.hgt");
            File file = new File(nazivDat);
            try{
                RandomAccessFile raf = new RandomAccessFile(file, "rw");
                GetData dat=new GetData(raf);
                int broj=0;
                double udaljenost=Math.abs(distance(du1,si1,du2,si2));
                double max=0;//MAX fresnel
                double maxFres=0;
                double fresnel,fresnelPlot;
                double rez,rezLos,rez1,rezPoc,rezKraj;
                int count=0;
                double razX=0,razY=0,razT;
                double dista1,dista2;
                double lambda=0.3/Double.parseDouble(frek);//frek u GHz --> lambda u m !!!!!!!!!!!
                double duljinaTrase=distance(du1,si1,du2,si2);
                int brUzoraka=10000;
                rezPoc=dat.getElevationFor(du1, si1)+visAnt1;
                rezKraj=dat.getElevationFor(du2, si2)+visAnt2;
                rezLos=Math.abs((dat.getElevationFor(du1, si1)+visAnt1)-(dat.getElevationFor(du2, si2)+visAnt2));
                
                while(count<=brUzoraka){
                    
                    razX=Math.abs(du1-du2)/brUzoraka;
                    razY=Math.abs(si1-si2)/brUzoraka;
                    razT=duljinaTrase/brUzoraka;
                    rez=dat.getElevationFor(du1+(razX*count), si1+(razY*count));

                    dista1=Math.abs(distance(du1,si1,du1+(razX*count),si1+(razY*count)));
                    dista2=Math.abs(distance(du2,si2,du1+(razX*count),si1+(razY*count)));
                    fresnel=1000*Math.sqrt((dista1*dista2*(lambda/1000))/(udaljenost));//fresnel radius 
                    if(fresnel>maxFres){
                        maxFres=fresnel;
                    }
                    

                    count++;
                    
                }    
                count=0;
                while(count<=brUzoraka){
                    
                    razX=Math.abs(du1-du2)/brUzoraka;
                    razY=Math.abs(si1-si2)/brUzoraka;
                    razT=duljinaTrase/brUzoraka;
                    rez=dat.getElevationFor(du1+(razX*count), si1+(razY*count));

                    dista1=Math.abs(distance(du1,si1,du1+(razX*count),si1+(razY*count)));
                    dista2=Math.abs(distance(du2,si2,du1+(razX*count),si1+(razY*count)));
                    fresnel=1000*Math.sqrt((dista1*dista2*(lambda/1000))/(udaljenost));//fresnel radius 

                    rez1=rezPoc+(count*rezLos/brUzoraka);
                    fresnelPlot=-Math.sqrt(dista1*dista1+fresnel*fresnel)-Math.sqrt(dista2*dista2+fresnel*fresnel)-udaljenost+rez1; //krivulja
                    if(0.1*(maxFres+rez)>fresnelPlot){
                        broj++;
                    }
                    //System.out.println(broj +" "+ dista1);
                    count++;
                    
                }   
                if(broj>0){
                    jLabel11.setVisible(true);
                    jLabel12.setVisible(false);
                } else {
                    jLabel11.setVisible(false);
                    jLabel12.setVisible(true);
                }
                
            }
            catch(IOException e){
                JOptionPane.showMessageDialog(rootPane, e.getMessage());
            }
    }//GEN-LAST:event_jButton3ActionPerformed