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 geometrical helpers
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13
// Copyright (C) 2001-2013 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 "
Position.h
"
37
#include "
PositionVector.h
"
38
#include <
utils/common/UtilExceptions.h
>
39
40
41
#ifndef PI
42
#define PI 3.1415926535897932384626433832795
43
#endif
44
45
#define DEG2RAD(x) static_cast<SUMOReal>((x) * PI / 180.)
46
#define RAD2DEG(x) static_cast<SUMOReal>((x) * 180. / PI)
47
48
// ===========================================================================
49
// class definitions
50
// ===========================================================================
54
class
GeomHelper
{
55
public
:
59
static
bool
intersects
(
const
Position
& p11,
const
Position
& p12,
60
const
Position
& p21,
const
Position
& p22);
61
66
static
Position
intersection_position2D
(
67
const
Position
& p11,
const
Position
& p12,
68
const
Position
& p21,
const
Position
& p22);
69
70
static
SUMOReal
Angle2D
(
SUMOReal
x1,
SUMOReal
y1,
SUMOReal
x2,
SUMOReal
y2);
71
72
static
Position
interpolate
(
const
Position
& p1,
73
const
Position
& p2,
SUMOReal
length);
74
75
static
Position
extrapolate_first
(
const
Position
& p1,
76
const
Position
& p2,
SUMOReal
length);
77
78
static
Position
extrapolate_second
(
const
Position
& p1,
79
const
Position
& p2,
SUMOReal
length);
80
81
static
SUMOReal
nearest_offset_on_line_to_point2D
(
82
const
Position
& l1,
const
Position
& l2,
83
const
Position
& p,
bool
perpendicular =
true
);
84
86
static
SUMOReal
distancePointLine
(
const
Position
& point,
87
const
Position
& lineStart,
const
Position
& lineEnd);
88
93
static
SUMOReal
closestDistancePointLine
(
const
Position
& point,
94
const
Position
& lineStart,
const
Position
& lineEnd,
95
Position
& outIntersection);
96
97
static
Position
transfer_to_side
(
Position
& p,
98
const
Position
& lineBeg,
const
Position
& lineEnd,
99
SUMOReal
amount);
100
101
102
static
Position
crossPoint
(
const
Boundary
& b,
103
const
PositionVector
& v);
104
105
static
std::pair<SUMOReal, SUMOReal>
getNormal90D_CW
(
const
Position
& beg,
106
const
Position
& end,
SUMOReal
length,
SUMOReal
wanted_offset);
107
108
static
std::pair<SUMOReal, SUMOReal>
getNormal90D_CW
(
const
Position
& beg,
109
const
Position
& end,
SUMOReal
wanted_offset);
110
116
static
SUMOReal
getCCWAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
117
118
124
static
SUMOReal
getCWAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
125
126
132
static
SUMOReal
getMinAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
133
134
140
static
SUMOReal
getMaxAngleDiff
(
SUMOReal
angle1,
SUMOReal
angle2);
141
142
143
private
:
147
static
bool
intersects
(
148
const
SUMOReal
x1,
const
SUMOReal
y1,
const
SUMOReal
x2,
const
SUMOReal
y2,
149
const
SUMOReal
x3,
const
SUMOReal
y3,
const
SUMOReal
x4,
const
SUMOReal
y4,
150
SUMOReal
* x,
SUMOReal
* y,
SUMOReal
* mu);
151
152
};
153
154
155
#endif
156
157
/****************************************************************************/
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
utils
geom
GeomHelper.h
Generated on Sun Jun 16 2013 07:07:05 for SUMO - Simulation of Urban MObility by
1.8.1.2