Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBHelpers.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Some mathematical helper methods
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <set>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class NBNode;
34class Position;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
44class NBHelpers {
45public:
47 static double relAngle(double angle1, double angle2);
48
50 static double normRelAngle(double angle1, double angle2);
51
53 static std::string normalIDRepresentation(const std::string& id);
54
56 static double distance(NBNode* node1, NBNode* node2);
57
59 static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);
60
62 static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);
63
69 static void interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index);
70};
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
static void interpretLaneID(const std::string &lane_id, std::string &edge_id, int &index)
parses edge-id and index from lane-id
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition NBHelpers.cpp:69
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Definition NBHelpers.cpp:45
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition NBHelpers.cpp:58
static double distance(NBNode *node1, NBNode *node2)
returns the distance between both nodes
Definition NBHelpers.cpp:80
static void loadEdgesFromFile(const std::string &file, std::set< std::string > &into)
Add edge ids defined in file (either ID or edge:ID per line) into the given set.
Definition NBHelpers.cpp:86
Represents a single node (junction) during network building.
Definition NBNode.h:66
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37