interpolatePoints method
Property that defines the tour interpolatePoints
according to its current properties.
Returns a list of interpolated points between two given points.
Implementation
List<LatLng> interpolatePoints(LatLng start, LatLng end) {
double distance = calculateDistance(start, end);
int numPoints = determineNumPoints(distance);
List<LatLng> interpolatedPoints = [];
double dLat = (end.latitude - start.latitude) / (numPoints + 1);
double dLng = (end.longitude - start.longitude) / (numPoints + 1);
for (int i = 1; i <= numPoints; i++) {
double lat = start.latitude + dLat * i;
double lng = start.longitude + dLng * i;
interpolatedPoints.add(LatLng(lat, lng));
}
return interpolatedPoints;
}