Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
types.h
1
2
/***************************************************************************
3
* types.h - Simple math related types
4
*
5
* Created: Thu Oct 30 14:32:38 2008
6
* Copyright 2008 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef __UTILS_MATH_TYPES_H_
25
#define __UTILS_MATH_TYPES_H_
26
27
#ifndef M_TWO_PI
28
#define M_TWO_PI 6.28318530717959
29
#endif
30
31
namespace
fawkes {
32
33
/** Point with cartesian coordinates as unsigned integers. */
34
typedef
struct
{
35
unsigned
int
x
;
/**< x coordinate */
36
unsigned
int
y
;
/**< y coordinate */
37
}
point_t
;
38
39
/** Cartesian coordinates (2D). */
40
typedef
struct
{
41
float
x
;
/**< x coordinate */
42
float
y
;
/**< y coordinate */
43
}
cart_coord_2d_t
;
44
45
/** Cartesian coordinates (3D). */
46
typedef
struct
{
47
float
x
;
/**< x coordinate */
48
float
y
;
/**< y coordinate */
49
float
z
;
/**< z coordinate */
50
}
cart_coord_3d_t
;
51
52
/** Polar coordinates. */
53
typedef
struct
{
54
float
r
;
/**< distance */
55
float
phi
;
/**< angle */
56
}
polar_coord_2d_t
;
57
58
/** Rectangular extent with unsigne integers. */
59
typedef
struct
{
60
unsigned
int
w
;
/**< width */
61
unsigned
int
h
;
/**< height */
62
}
extent_2d_t
;
63
64
/** Rectangle (unsigned integers) */
65
typedef
struct
{
66
point_t
start
;
/**< start point */
67
extent_2d_t
extent
;
/**< extent */
68
}
rectangle_t
;
69
70
/** Position on the field. */
71
typedef
struct
{
72
float
x
;
/**< x coordinate in meters */
73
float
y
;
/**< y coordinate in meters */
74
float
ori
;
/**< orientation */
75
}
field_pos_t
;
76
77
/** Describes a field line */
78
typedef
struct
field_line_struct
{
79
cart_coord_2d_t
start
;
/**< start of the line [m] */
80
cart_coord_2d_t
end
;
/**< end of the line [m] */
81
82
/**
83
* Constructor
84
* @param start of the line
85
* @param end of the line
86
*/
87
field_line_struct
(
fawkes::cart_coord_2d_t
start
,
fawkes::cart_coord_2d_t
end
)
88
{
89
this->start =
start
;
90
this->end =
end
;
91
}
92
93
/**
94
* Constructor
95
* @param start_x of the line
96
* @param start_y of the line
97
* @param end_x of the line
98
* @param end_y of the line
99
*/
100
field_line_struct
(
float
start_x,
float
start_y,
float
end_x,
float
end_y)
101
{
102
this->
start
.
x
= start_x;
103
this->
start
.
y
= start_y;
104
this->
end
.
x
= end_x;
105
this->
end
.
y
= end_y;
106
}
107
}
field_line_t
;
108
109
/** Defines an arc (or circle) */
110
typedef
struct
arc_struct
{
111
/** Constructor.
112
* @param radius The radius of the arc or circle
113
* @param center_x The x-coordinate of the center of the arc or circle
114
* @param center_y The y-coordinate of the center of the arc or circle
115
* @param start_phi The start angle of the arc
116
* @param end_phi The end angle of the arc
117
*/
118
arc_struct
(
float
radius
,
float
center_x,
float
center_y,
float
start_phi
= 0,
float
end_phi
= M_TWO_PI) {
119
this->radius =
radius
;
120
this->
center
.
x
= center_x;
121
this->
center
.
y
= center_y;
122
this->
start_phi
=
start_phi
;
123
this->
end_phi
=
end_phi
;
124
}
125
126
float
radius
;
/**< The radius of the arc or circle */
127
cart_coord_2d_t
center
;
/**< The center of the arc or circle */
128
float
start_phi
;
/**< The start angle of the arc */
129
float
end_phi
;
/**< The end angle of the arc */
130
}
arc_t
;
131
132
/** Defines a point with 6-degrees of freedom */
133
typedef
struct
point_6D_struct
{
134
float
x
;
/**< The x-coordinate of the point */
135
float
y
;
/**< The y-coordinate of the point */
136
float
z
;
/**< The z-coordinate of the point */
137
float
roll
;
/**< The angle around the x-axis */
138
float
pitch
;
/**< The angle around the y-axis */
139
float
yaw
;
/**< The angle around the z-axis */
140
}
point_6D_t
;
141
142
}
// end namespace fawkes
143
144
#endif
src
libs
utils
math
types.h
Generated by
1.8.1.1