/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-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 NBHelpers.h14/// @author Daniel Krajzewicz15/// @author Sascha Krieg16/// @author Michael Behrisch17/// @author Jakob Erdmann18/// @date Tue, 20 Nov 200119///20// Some mathematical helper methods21/****************************************************************************/22#pragma once23#include <config.h>2425#include <string>26#include <set>272829// ===========================================================================30// class declarations31// ===========================================================================32class NBNode;33class Position;343536// ===========================================================================37// class definitions38// ===========================================================================39/**40* @class NBHelpers41* Some mathmatical methods for the computation of angles42*/43class NBHelpers {44public:45/// @brief computes the relative angle between the two angles46static double relAngle(double angle1, double angle2);4748/// @brief ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)49static double normRelAngle(double angle1, double angle2);5051/// @brief converts the numerical id to its "normal" string representation52static std::string normalIDRepresentation(const std::string& id);5354/// @brief returns the distance between both nodes55static double distance(NBNode* node1, NBNode* node2);5657/// @brief Add edge ids defined in file (either ID or edge:ID per line) into the given set58static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);5960/// @brief Add prefixed ids defined in file61static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);6263/** @brief parses edge-id and index from lane-id64* @param[in] lane_id The lane-id65* @param[out] edge_id ID of this lane's edge66* @param[out] index Index of this lane67*/68static void interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index);69};707172