I'm working on a project that detect is marker inside circle I have this code but this code is not working in short distances
double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
double distance =math.acos(math.sin(lat1)*math.sin(lat2)+math.cos(lat1)*math.cos(lat2)*math.cos(lon2-lon1))*6371;
return distance;
}
bool isMarkerInsideCircle(Marker marker, Circle circle) {
double distanceBetweenPoints = calculateDistance(
marker.position.latitude,
marker.position.longitude,
circle.center.latitude,
circle.center.longitude,
);
return distanceBetweenPoints <= circle.radius;
}