/**
 * Given the loads at three supports (A, B, C) on a truss bridge, calculate the reaction forces.
 *
 * @param loadA Load at support A in kN.
 * @param loadB Load at support B in kN.
 * @param loadC Load at support C in kN.
 * @return A tuple containing the reaction forces Ra, Rb, Rc in kN.
 */
fun calculateTrussReactionForces(loadA: Double, loadB: Double, loadC: Double): Triple<Double, Double, Double> {

    // Calculate the sum of all loads
    val sumOfLoads = loadA + loadB + loadC

    // Determine if the truss is in equilibrium
    val isEquilibrium = sumOfLoads == 0.0

    // Use ternary operators to calculate the reaction forces based on the truss equilibrium state
    val Ra = if (isEquilibrium) loadA else -loadA
    val Rb = if (isEquilibrium) loadB else -loadB
    val Rc = if (isEquilibrium) loadC else -loadC

    return Triple(Ra, Rb, Rc)
}
/**
 * Given the loads at three supports (A, B, C) on a truss bridge, calculate the reaction forces.
 *
 * @param loadA Load at support A in kN.
 * @param loadB Load at support B in kN.
 * @param loadC Load at support C in kN.
 * @return A tuple containing the reaction forces Ra, Rb, Rc in kN.
 */
fun calculateTrussReactionForces(loadA: Double, loadB: Double, loadC: Double): Triple<Double, Double, Double> {
/**
 * Given the loads at three supports (A, B, C) on a truss bridge, calculate the reaction forces.
 *
 * @param loadA Load at support A in kN.
 * @param loadB Load at support B in kN.
 * @param loadC Load at support C in kN.
 * @return A tuple containing the reaction forces Ra, Rb, Rc in kN.
 */
fun calculateTrussReactionForces(loadA: Double, loadB: Double, loadC: Double): Triple<Double, Double, Double> {

    // Calculate the sum of all loads
    val sumOfLoads = loadA + loadB + loadC

    // Determine if the truss is in equilibrium
    val isEquilibrium = sumOfLoads == 0.0

    // Use ternary operators to calculate the reaction forces based on the truss equilibrium state
    val Ra = if (isEquilibrium) loadA else -loadA
    val Rb = if (isEquilibrium) loadB else -loadB
    val Rc = if (isEquilibrium) loadC else -loadC

    return Triple(Ra, Rb, Rc)
}