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
angles.h
Go to the documentation of this file.
1
/************************************************************************
2
* *
3
* Copyright 2004, Brown University, Providence, RI *
4
* *
5
* Permission to use and modify this software and its documentation *
6
* for any purpose other than its incorporation into a commercial *
7
* product is hereby granted without fee. Recipient agrees not to *
8
* re-distribute this software or any modifications of this *
9
* software without the permission of Brown University. Brown *
10
* University makes no representations or warrantees about the *
11
* suitability of this software for any purpose. It is provided *
12
* "as is" without express or implied warranty. Brown University *
13
* requests notification of any modifications to this software or *
14
* its documentation. Notice should be sent to: *
15
* *
16
* To: *
17
* Software Librarian *
18
* Laboratory for Engineering Man/Machine Systems, *
19
* Division of Engineering, Box D, *
20
* Brown University *
21
* Providence, RI 02912 *
22
* Software_Librarian@lems.brown.edu *
23
* *
24
* We will acknowledge all electronic notifications. *
25
* *
26
************************************************************************/
27
28
#ifndef _ANGLES_H
29
#define _ANGLES_H
30
31
#include <cmath>
32
33
//##########################################################
34
// THE ANGLE DEFINITIONS
35
//##########################################################
36
#ifndef M_PI
37
#define M_PI 3.1415926535897932384626433832795
38
#endif
39
40
inline
double
angle0To2Pi
(
double
angle)
41
{
42
#if 0
43
while
(angle >=
M_PI
*2)
44
angle -=
M_PI
*2;
45
while
(angle < 0)
46
angle +=
M_PI
*2;
47
return
angle;
48
#else
49
if
(angle>2*
M_PI
)
50
return
fmod (angle,
M_PI
*2);
51
else
if
(angle < 0)
52
return
(2*
M_PI
+ fmod (angle,
M_PI
*2));
53
else
return
angle;
54
#endif
55
}
56
57
inline
double
CCW
(
double
reference,
double
angle1)
58
{
59
double
fangle1 =
angle0To2Pi
(angle1);
60
double
fref =
angle0To2Pi
(reference);
61
62
if
(fref > fangle1){
63
return
angle0To2Pi
(2*
M_PI
- (fref - fangle1));
64
}
65
else
66
return
angle0To2Pi
(fangle1 - fref);
67
}
68
69
#endif
tmp
buildd
sumo-0.21.0+dfsg
src
foreign
eulerspiral
angles.h
Generated on Thu Nov 20 2014 19:49:52 for SUMO - Simulation of Urban MObility by
1.8.1.2