public static Double interpolateCourse(Double c1, Double c2, double fraction) {

        if (c1 == null || c2 == null) {
            return null;
        }

        checkArgument(VALID_COURSE_RANGE.contains(c1), "The 1st course: " + c1 + " is not in range");
        checkArgument(VALID_COURSE_RANGE.contains(c2), "The 2nd course: " + c2 + " is not in range");
        checkArgument(VALID_FRACTION_RANGE.contains(fraction), "The fraction: " + fraction + " is not in range");

        double angleDelta = Spherical.angleDifference(c2, c1);
        Double course = c1 + interpolate(0.0, angleDelta, fraction);
        return Spherical.mod(course, 360.0d);
    }
@Test
    public void testInterpolateCourse_bug() {
        //A bug was found when interpolating between a Point with course 178 and a Point with 181
        double TOL = 0.001;
        assertEquals(
            178.0,
            interpolateCourse(178.0, 181.0, 0.0),
            TOL
        );
        assertEquals(
            181.0,
            interpolateCourse(178.0, 181.0, 1.0),
            TOL
        );
        //this assertion failed ... result was 106.6
        assertEquals(
            178.6,
            interpolateCourse(178.0, 181.0, 0.2),
            TOL
        );
    }