Commits

Ahmed Youssef  committed c974b1f

getQiblaDistance

  • Participants
  • Parent commits 8640ec5

Comments (0)

Files changed (1)

File JPrayertimes/src/net/pf/jprayertimes/Prayertimes.java

         return q;
 
     }
+    public double getQiblaDistance(){
+        double k_lat = toRadians(21.423333);
+        double k_lon = toRadians(39.823333);
+
+        double lon_r = toRadians(this.longitude);
+        double lat_r = toRadians(this.latitude);
+
+        double r = 6378.7;
+        return acos(sin(k_lat) * sin(latitude) + cos(k_lat) * cos(latitude) * cos(longitude-k_lon)) * r;
+    }
 
     public void report() {
         System.out.println("Fajr: " + this.getHRFajrTime());