/**
 * Calculate the bearing angle between two directions.
 *
 * Given the angles of two directions, this function calculates and returns the bearing angle.
 *
 * @param angle1 The angle of the first direction in degrees.
 * @param angle2 The angle of the second direction in degrees.
 * @return The bearing angle between angle1 and angle2 in degrees.
 */
fun calculateBearing(angle1: Double, angle2: Double): String {

    // Calculate the absolute difference between angle1 and angle2
    val angleDiff = Math.abs(angle1 - angle2)

    // Check if the absolute difference is within a specific range and return a corresponding output
    return when {
        angleDiff <= 45 || angleDiff >= 315 -> "North"
        angleDiff > 45 && angleDiff <= 135 -> "East"
        angleDiff > 135 && angleDiff <= 225 -> "South"
        else -> "West"
    }
}
/**
 * Calculate the bearing angle between two directions.
 *
 * Given the angles of two directions, this function calculates and returns the bearing angle.
 *
 * @param angle1 The angle of the first direction in degrees.
 * @param angle2 The angle of the second direction in degrees.
 * @return The bearing angle between angle1 and angle2 in degrees.
 */
fun calculateBearing(angle1: Double, angle2: Double): String {
/**
 * Calculate the bearing angle between two directions.
 *
 * Given the angles of two directions, this function calculates and returns the bearing angle.
 *
 * @param angle1 The angle of the first direction in degrees.
 * @param angle2 The angle of the second direction in degrees.
 * @return The bearing angle between angle1 and angle2 in degrees.
 */
fun calculateBearing(angle1: Double, angle2: Double): String {

    // Calculate the absolute difference between angle1 and angle2
    val angleDiff = Math.abs(angle1 - angle2)

    // Check if the absolute difference is within a specific range and return a corresponding output
    return when {
        angleDiff <= 45 || angleDiff >= 315 -> "North"
        angleDiff > 45 && angleDiff <= 135 -> "East"
        angleDiff > 135 && angleDiff <= 225 -> "South"
        else -> "West"
    }
}