Main Page
Namespaces
Classes
Files
File List
File Members
igvc
src
pathplanner
searchlocation.cpp
Go to the documentation of this file.
1
#include "
searchlocation.h
"
2
#include <math.h>
// pow() & sqrt()
3
#include <cmath>
// abs()
4
5
SearchLocation::SearchLocation
(
float
_x,
float
_y,
float
_theta)
6
{
7
x
= _x;
8
y
= _y;
9
theta
= _theta;
10
}
11
12
bool
SearchLocation::operator ==
(
const
SearchLocation
&other)
13
{
14
return
std::abs(
x
- other.
x
) <
sameness_threshold
&& std::abs(
y
- other.
y
) <
sameness_threshold
;
// && abs(theta - other.theta) < sameness_threshold;
15
}
16
17
bool
SearchLocation::operator <
(
const
SearchLocation
&other)
const
18
{
19
if
(
x
< other.
x
)
20
{
21
return
true
;
22
}
23
else
if
(
y
< other.
y
)
24
{
25
return
true
;
26
}
27
else
if
(
theta
< other.
theta
)
28
{
29
return
true
;
30
}
31
return
false
;
32
}
33
34
float
SearchLocation::distTo
(
SearchLocation
other)
35
{
36
return
sqrt(pow(other.
x
-
x
, 2) + pow(other.
y
-
y
, 2));
37
}
SearchLocation
Definition:
searchlocation.h:6
SearchLocation::theta
float theta
Definition:
searchlocation.h:9
SearchLocation::distTo
float distTo(SearchLocation other)
Definition:
searchlocation.cpp:34
searchlocation.h
SearchLocation::SearchLocation
SearchLocation()
Definition:
searchlocation.h:13
SearchLocation::sameness_threshold
static constexpr float sameness_threshold
Definition:
searchlocation.h:11
SearchLocation::x
float x
Definition:
searchlocation.h:9
SearchLocation::y
float y
Definition:
searchlocation.h:9
SearchLocation::operator<
bool operator<(const SearchLocation &other) const
Definition:
searchlocation.cpp:17
SearchLocation::operator==
bool operator==(const SearchLocation &other)
Definition:
searchlocation.cpp:12
igvc
Author(s): Matthew Barulic
, Al Chaussee
autogenerated on Sun May 10 2015 16:18:45