@Test void angle_from_depot_at_zero_should_be_atan2_of_latitude_longitude() { PlanningLocation center = locationAt(0, 0); assertThat(center.angleTo(locationAt(0, 1))).isZero(); assertThat(center.angleTo(locationAt(0, -1))).isEqualTo(Math.PI); assertThat(center.angleTo(locationAt(1, 0))).isEqualTo(Math.PI / 2); assertThat(center.angleTo(locationAt(-1, 0))).isEqualTo(-Math.PI / 2); assertThat(center.angleTo(locationAt(-Double.MIN_VALUE, -1))).isEqualTo(-Math.PI); assertThat(center.angleTo(locationAt(-0, 1))).isZero(); }
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();  }