SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GeomHelper.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// Some static methods performing geometrical operations
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13
// Copyright (C) 2001-2014 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 GeomHelper_h
24
#define GeomHelper_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 <cmath>
37
#include "
Position.h
"
38
#include "
PositionVector.h
"
39
#include <
utils/common/UtilExceptions.h
>
40
41
#ifndef M_PI
42
#define M_PI 3.1415926535897932384626433832795
43
#endif
44
45
#define DEG2RAD(x) static_cast<SUMOReal>((x) * M_PI / 180.)
46
#define RAD2DEG(x) static_cast<SUMOReal>((x) * 180. / M_PI)
47
48
49
// ===========================================================================
50
// class definitions
51
// ===========================================================================
55
class
GeomHelper
{
56
public
:
64
static
bool
intersects
(
const
Position
& p11,
const
Position
& p12,
65
const
Position
& p21,
const
Position
& p22);
66
67
74
static
bool
pointOnLine
(
const
Position
& p,
const
Position
& from,
const
Position
& to);
75
76
86
static
void
FindLineCircleIntersections
(
const
Position
& c,
SUMOReal
radius,
const
Position
& p1,
const
Position
& p2,
87
std::vector<SUMOReal>& into);
88
89
94
static
Position
intersection_position2D
(
95
const
Position
& p11,
const
Position
& p12,
96
const
Position
& p21,
const
Position
& p22);
97
98
static
SUMOReal
Angle2D
(
SUMOReal
x1,
SUMOReal
y1,
SUMOReal
x2,
SUMOReal
y2);
99
100
static
Position
interpolate
(
const
Position
& p1,
101
const
Position
& p2,
SUMOReal
length);
102
103
static
Position
extrapolate_first
(
const
Position
& p1,
104
const
Position
& p2,
SUMOReal
length);
105
106
static
Position
extrapolate_second
(
const
Position
& p1,
107
const
Position
& p2,
SUMOReal
length);
108
109
static
SUMOReal
nearest_offset_on_line_to_point2D
(
110
const
Position
& l1,
const
Position
& l2,
111
const
Position
& p,
bool
perpendicular =
true
);
112
114
static
SUMOReal
distancePointLine
(
const
Position
& point,
115
const
Position
& lineStart,
const
Position
& lineEnd);
116
121
static
SUMOReal
closestDistancePointLine
(
const
Position
& point,
122
const
Position
& lineStart,
const
Position
& lineEnd,
123
Position
& outIntersection);
124
125
static
Position
transfer_to_side
(
Position
& p,
126
const
Position
& lineBeg,
const
Position
& lineEnd,
127
SUMOReal
amount);
128
129
130
static
Position
crossPoint
(
const
Boundary
& b,
131
const
PositionVector
& v);
132
133
static
std::pair<SUMOReal, SUMOReal>
getNormal90D_CW
(
const
Position
& beg,
134
const
Position
& end,
SUMOReal
length,
SUMOReal
wanted_offset);
135
136
static
std::pair<SUMOReal, SUMOReal>
getNormal90D_CW
(
const
Position
& beg,
137
const
Position
& end,
SUMOReal
wanted_offset);
138
144
static
SUMOReal
getCCWAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
145
146
152
static
SUMOReal
getCWAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
153
154
160
static
SUMOReal
getMinAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
161
162
168
static
SUMOReal
getMaxAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
169
170
171
private
:
175
static
bool
intersects
(
176
const
SUMOReal
x1,
const
SUMOReal
y1,
const
SUMOReal
x2,
const
SUMOReal
y2,
177
const
SUMOReal
x3,
const
SUMOReal
y3,
const
SUMOReal
x4,
const
SUMOReal
y4,
178
SUMOReal
* x,
SUMOReal
* y,
SUMOReal
* mu);
179
180
};
181
182
183
#endif
184
185
/****************************************************************************/
tmp
buildd
sumo-0.21.0+dfsg
src
utils
geom
GeomHelper.h
Generated on Thu Nov 20 2014 19:49:53 for SUMO - Simulation of Urban MObility by
1.8.1.2