GetJedi/app/src/main/java/edu/getjedi/frontend/mobile/state/ClientLoggedState.java
private boolean filterRay(String latitude, String longitude) {
        try {
            double radius;
            double x0 = context.getUser().getCoordinates().latitude;
            double y0 = context.getUser().getCoordinates().longitude;
            double x1 = Double.parseDouble(latitude);
            double y1 = Double.parseDouble(longitude);
            radius = Double.parseDouble(this.rayFilter);

            //Ratio for earth surface - Harvarsine Formula
            double deglen = 110.25;
            double x = x1 - x0;
            double y = (y1 - y0) * Math.cos(x0);
            double distance = deglen * Math.sqrt(x*x + y*y);

            return ( distance <= radius);
        }catch (Exception e){
            return true;
        }
    }
/**
     * Applies the ray filter for updateMap(), returning true if the service passes the maximum ray requirement.
     */
Applies the ray filter for updateMap(), returning true if the service passes the maximum ray requirement.
Applies the ray filter for updateMap () returning true if the service passes the maximum ray requirement .
private boolean filterRay(String latitude, String longitude) {
        try {
            double radius;
            double x0 = context.getUser().getCoordinates().latitude;
            double y0 = context.getUser().getCoordinates().longitude;
            double x1 = Double.parseDouble(latitude);
            double y1 = Double.parseDouble(longitude);
            radius = Double.parseDouble(this.rayFilter);
            double deglen = 110.25;
            double x = x1 - x0;
            double y = (y1 - y0) * Math.cos(x0);
            double distance = deglen * Math.sqrt(x*x + y*y);
            return ( distance <= radius);
        }catch (Exception e){
            return true;
        }
    }
private boolean filterRay ( String latitude , String longitude ) { try { double radius ; double x0 = context . getUser ( ) . getCoordinates ( ) . latitude ; double y0 = context . getUser ( ) . getCoordinates ( ) . longitude ; double x1 = Double . parseDouble ( latitude ) ; double y1 = Double . parseDouble ( longitude ) ; radius = Double . parseDouble ( this . rayFilter ) ; double deglen = 110.25 ; double x = x1 - x0 ; double y = ( y1 - y0 ) * Math . cos ( x0 ) ; double distance = deglen * Math . sqrt ( x * x + y * y ) ; return ( distance <= radius ) ; } catch ( Exception e ) { return true ; } }
Applies the ray filter for updateMap(), returning true if the service passes the maximum ray requirement.
Applies the ray filter for updateMap () returning true if the service passes the maximum ray requirement .
//Ratio for earth surface - Harvarsine Formula