Check if a latitude and longitude is within a circle

前端 未结 6 1708
一整个雨季
一整个雨季 2020-12-04 13:47

See this illustration:

\"enter

What I would like to know is:

  1. How
6条回答
  •  独厮守ぢ
    2020-12-04 14:14

    Check this:

     private boolean isMarkerOutsideCircle(LatLng centerLatLng, LatLng draggedLatLng, double radius) {
        float[] distances = new float[1];
        Location.distanceBetween(centerLatLng.latitude,
                centerLatLng.longitude,
                draggedLatLng.latitude,
                draggedLatLng.longitude, distances);
        return radius < distances[0];
    }
    

提交回复
热议问题