@Test void angle_from_depot_on_real_coordinates_should_be_atan2_of_latitude_longitude() { PlanningLocation depot = locationAt(1.77, -10.5); Offset<Double> offset = offset(0.05); assertThat(depot.angleTo(locationAt(1.76, -5))).isCloseTo(0, offset).isNegative(); assertThat(depot.angleTo(locationAt(100000, -1))).isCloseTo(Math.PI / 2, offset); }
public double angleTo(PlanningLocation location) { double latitudeDifference = location.latitude - latitude; double longitudeDifference = location.longitude - longitude; return Math.atan2(latitudeDifference, longitudeDifference); }
PlanningLocation { public double angleTo(PlanningLocation location) { double latitudeDifference = location.latitude - latitude; double longitudeDifference = location.longitude - longitude; return Math.atan2(latitudeDifference, longitudeDifference); } }
PlanningLocation { public double angleTo(PlanningLocation location) { double latitudeDifference = location.latitude - latitude; double longitudeDifference = location.longitude - longitude; return Math.atan2(latitudeDifference, longitudeDifference); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); }
PlanningLocation { public double angleTo(PlanningLocation location) { double latitudeDifference = location.latitude - latitude; double longitudeDifference = location.longitude - longitude; return Math.atan2(latitudeDifference, longitudeDifference); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); long getId(); long distanceTo(PlanningLocation location); double angleTo(PlanningLocation location); @Override String toString(); }
PlanningLocation { public double angleTo(PlanningLocation location) { double latitudeDifference = location.latitude - latitude; double longitudeDifference = location.longitude - longitude; return Math.atan2(latitudeDifference, longitudeDifference); } PlanningLocation(long id, double latitude, double longitude, DistanceMap travelDistanceMap); long getId(); long distanceTo(PlanningLocation location); double angleTo(PlanningLocation location); @Override String toString();  }