SUMO - Simulation of Urban MObility
NBHelpers.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Some mathematical helper methods
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef NBHelpers_h
24 #define NBHelpers_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <set>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class NBNode;
44 class Position;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class NBHelpers {
55 public:
57  static double relAngle(double angle1, double angle2);
58 
60  static double normRelAngle(double angle1, double angle2);
61 
63  static std::string normalIDRepresentation(const std::string& id);
64 
66  static double distance(NBNode* node1, NBNode* node2);
67 
69  static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);
70 
72  static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);
73 };
74 
75 
76 #endif
77 
78 /****************************************************************************/
79 
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Definition: NBHelpers.cpp:52
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
Definition: NBHelpers.cpp:111
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition: NBHelpers.cpp:65
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:93
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition: NBHelpers.cpp:76
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
static double distance(NBNode *node1, NBNode *node2)
returns the distance between both nodes
Definition: NBHelpers.cpp:87
Represents a single node (junction) during network building.
Definition: NBNode.h:75