/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2005-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file PolySolver.h14/// @author Jakub Sevcik (RICE)15/// @author Jan Prikryl (RICE)16/// @date 2019-12-0617///18//19/****************************************************************************/20#pragma once21#include <config.h>22#include <tuple>2324// ===========================================================================25// class definitions26// ===========================================================================27/**28* @class PolySolver29* @brief Utility functions for solving quadratic and cubic equations in real domain.30*/31class PolySolver {32public:3334/** @brief Solver of quadratic equation ax^2 + bx + c = 035*36* Returns only real-valued roots.37*38* @param[in] a The coefficient of the quadratic term x^239* @param[in] b The coefficient of the linear term x40* @param[in] c The coefficient of the constant term41* @return The number of real roots and these real roots42*/43static std::tuple<int, double, double> quadraticSolve(double a, double b, double c);4445/** @brief Solver of cubic equation ax^3 + bx^2 + cx + d = 046*47* Returns only real-valued roots.48*49* @param[in] a The coefficient of the cubic term x^350* @param[in] b The coefficient of the quadratic term x^251* @param[in] c The coefficient of the linear term x52* @param[in] d The coefficient of the constant term53* @return The number of real roots and these real roots54*/55static std::tuple<int, double, double, double> cubicSolve(double a, double b, double c, double d);5657};585960