Class
List
Heirarchy
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 2011 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
37
class
Vector2i
38
{
40
public
:
Vector2i
();
41
45
public
:
Vector2i
(
const
int
&_x,
const
int
&_y);
46
49
public
:
Vector2i
(
const
Vector2i
&_pt);
50
52
public
:
virtual
~Vector2i
();
53
57
public
:
int
Distance
(
const
Vector2i
&_pt)
const
;
58
60
public
:
void
Normalize
();
61
65
public
:
void
Set
(
int
_x,
int
_y);
66
70
public
:
Vector2i
Cross
(
const
Vector2i
&_pt)
const
;
71
75
public
:
Vector2i
&
operator =
(
const
Vector2i
&_v);
76
80
public
:
const
Vector2i
&
operator =
(
int
_value);
81
85
public
:
Vector2i
operator+
(
const
Vector2i
&_v)
const
;
86
90
public
:
const
Vector2i
&
operator+=
(
const
Vector2i
&_v);
91
95
public
:
Vector2i
operator-
(
const
Vector2i
&_v)
const
;
96
100
public
:
const
Vector2i
&
operator-=
(
const
Vector2i
&_v);
101
106
public
:
const
Vector2i
operator/
(
const
Vector2i
&_v)
const
;
107
112
public
:
const
Vector2i
&
operator/=
(
const
Vector2i
&_v);
113
118
public
:
const
Vector2i
operator/
(
int
_v)
const
;
119
124
public
:
const
Vector2i
&
operator/=
(
int
_v);
125
130
public
:
const
Vector2i
operator*
(
const
Vector2i
&_v)
const
;
131
136
public
:
const
Vector2i
&
operator*=
(
const
Vector2i
&_v);
137
141
public
:
const
Vector2i
operator*
(
int
_v)
const
;
142
146
public
:
const
Vector2i
&
operator*=
(
int
_v);
147
151
public
:
bool
operator ==
(
const
Vector2i
&_v)
const
;
152
156
public
:
bool
operator!=
(
const
Vector2i
&_v)
const
;
157
160
public
:
bool
IsFinite
()
const
;
161
164
public
:
int
operator[]
(
unsigned
int
_index)
const
;
165
167
public
:
int
x
;
168
170
public
:
int
y
;
171
176
public
:
friend
std::ostream &
operator<<
(std::ostream &_out,
177
const
gazebo::math::Vector2i
&_pt)
178
{
179
_out << _pt.
x
<<
" "
<< _pt.
y
;
180
return
_out;
181
}
182
187
public
:
friend
std::istream &
operator>>
(std::istream &_in,
188
gazebo::math::Vector2i
&_pt)
189
{
190
// Skip white spaces
191
_in.setf(std::ios_base::skipws);
192
_in >> _pt.
x
>> _pt.
y
;
193
return
_in;
194
}
195
};
196
198
}
199
}
200
#endif
201
202
203