Class
List
Hierarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
math
Vector2i.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Nate Koenig
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUint WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
/* Desc: Two dimensional vector
18
* Author: Nate Koenig
19
* Date: 3 Apr 2007
20
*/
21
22
#ifndef _VECTOR2I_HH_
23
#define _VECTOR2I_HH_
24
25
#include <math.h>
26
#include <iostream>
27
#include <fstream>
28
29
namespace
gazebo
30
{
31
namespace
math
32
{
35
38
class
Vector2i
39
{
41
public
:
Vector2i
();
42
46
public
:
Vector2i
(
const
int
&_x,
const
int
&_y);
47
50
public
:
Vector2i
(
const
Vector2i
&_pt);
51
53
public
:
virtual
~Vector2i
();
54
58
public
:
int
Distance
(
const
Vector2i
&_pt)
const
;
59
61
public
:
void
Normalize
();
62
66
public
:
void
Set
(
int
_x,
int
_y);
67
71
public
:
Vector2i
Cross
(
const
Vector2i
&_pt)
const
;
72
76
public
:
Vector2i
&
operator =
(
const
Vector2i
&_v);
77
81
public
:
const
Vector2i
&
operator =
(
int
_value);
82
86
public
:
Vector2i
operator+
(
const
Vector2i
&_v)
const
;
87
91
public
:
const
Vector2i
&
operator+=
(
const
Vector2i
&_v);
92
96
public
:
Vector2i
operator-
(
const
Vector2i
&_v)
const
;
97
101
public
:
const
Vector2i
&
operator-=
(
const
Vector2i
&_v);
102
107
public
:
const
Vector2i
operator/
(
const
Vector2i
&_v)
const
;
108
113
public
:
const
Vector2i
&
operator/=
(
const
Vector2i
&_v);
114
119
public
:
const
Vector2i
operator/
(
int
_v)
const
;
120
125
public
:
const
Vector2i
&
operator/=
(
int
_v);
126
131
public
:
const
Vector2i
operator*
(
const
Vector2i
&_v)
const
;
132
137
public
:
const
Vector2i
&
operator*=
(
const
Vector2i
&_v);
138
142
public
:
const
Vector2i
operator*
(
int
_v)
const
;
143
147
public
:
const
Vector2i
&
operator*=
(
int
_v);
148
152
public
:
bool
operator ==
(
const
Vector2i
&_v)
const
;
153
157
public
:
bool
operator!=
(
const
Vector2i
&_v)
const
;
158
161
public
:
bool
IsFinite
()
const
;
162
165
public
:
int
operator[]
(
unsigned
int
_index)
const
;
166
168
public
:
int
x
;
169
171
public
:
int
y
;
172
177
public
:
friend
std::ostream &
operator<<
(std::ostream &_out,
178
const
gazebo::math::Vector2i
&_pt)
179
{
180
_out << _pt.
x
<<
" "
<< _pt.
y
;
181
return
_out;
182
}
183
188
public
:
friend
std::istream &
operator>>
(std::istream &_in,
189
gazebo::math::Vector2i
&_pt)
190
{
191
// Skip white spaces
192
_in.setf(std::ios_base::skipws);
193
_in >> _pt.
x
>> _pt.
y
;
194
return
_in;
195
}
196
};
197
199
}
200
}
201
#endif
202
203
204