NAO documentation
|
C++ Libraries
|
index
libalmath
1.14
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Groups
Pages
almath
types
alposition2d.h
1
/*
2
* Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
3
* Use of this source code is governed by a BSD-style license that can be
4
* found in the COPYING file.
5
*/
6
7
8
#pragma once
9
#ifndef _LIBALMATH_ALMATH_TYPES_ALPOSITION2D_H_
10
#define _LIBALMATH_ALMATH_TYPES_ALPOSITION2D_H_
11
12
#include <vector>
13
14
namespace
AL {
15
namespace
Math {
16
23
struct
Position2D
24
{
26
float
x
;
28
float
y
;
29
32
43
44
Position2D
();
45
48
59
60
61
62
explicit
Position2D
(
float
pInit);
63
66
77
78
79
80
Position2D
(
float
pX,
float
pY);
81
84
95
96
97
98
99
100
Position2D
(
const
std::vector<float>& pFloats);
101
106
Position2D
operator+
(
const
Position2D
& pPos2)
const
;
107
112
Position2D
operator-
(
const
Position2D
& pPos2)
const
;
113
117
Position2D
operator+
()
const
;
118
122
Position2D
operator-
()
const
;
123
128
Position2D
&
operator+=
(
const
Position2D
& pPos2);
129
134
Position2D
&
operator-=
(
const
Position2D
& pPos2);
135
143
bool
operator==
(
const
Position2D
& pPos2)
const
;
144
152
bool
operator!=
(
const
Position2D
& pPos2)
const
;
153
158
Position2D
operator*
(
float
pVal)
const
;
159
164
Position2D
operator/
(
float
pVal)
const
;
165
170
Position2D
&
operator*=
(
float
pVal);
171
176
Position2D
&
operator/=
(
float
pVal);
177
188
float
distanceSquared
(
const
Position2D
& pPos2)
const
;
189
200
float
distance
(
const
Position2D
& pPos2)
const
;
201
211
bool
isNear
(
212
const
Position2D
& pPos2,
213
const
float
& pEpsilon=0.0001f)
const
;
214
223
float
norm
()
const
;
224
233
Position2D
normalize
()
const
;
234
245
float
crossProduct
(
const
Position2D
& pPos2)
const
;
246
250
std::vector<float>
toVector
()
const
;
251
};
252
253
// TODO : Need this ?
254
Position2D
operator*
(
255
const
float
pM,
256
const
Position2D
& pPos1);
257
269
float
distanceSquared
(
270
const
Position2D
& pPos1,
271
const
Position2D
& pPos2);
272
284
float
distance
(
285
const
Position2D
& pPos1,
286
const
Position2D
& pPos2);
287
298
float
norm
(
const
Position2D
& pPos);
299
310
Position2D
normalize
(
const
Position2D
& pPos);
311
323
float
crossProduct
(
324
const
Position2D
& pPos1,
325
const
Position2D
& pPos2);
326
337
void
crossProduct
(
338
const
Position2D
& pPos1,
339
const
Position2D
& pPos2,
340
float
& pRes);
341
342
}
// end namespace math
343
}
// end namespace al
344
#endif // _LIBALMATH_ALMATH_TYPES_ALPOSITION2D_H_
Copyright Aldebaran Robotics