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
Vector4.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
* WITHOUT 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: 4 tuple
18
* Author: Nate Koenig
19
* Date: 19 Aug 2008
20
*/
21
22
#ifndef VECTOR4_HH
23
#define VECTOR4_HH
24
25
#include <iostream>
26
#include <fstream>
27
#include "
math/Matrix4.hh
"
28
29
namespace
gazebo
30
{
31
namespace
math
32
{
35
37
class
Vector4
38
{
40
public
:
Vector4
();
41
47
public
:
Vector4
(
const
double
&_x,
const
double
&_y,
const
double
&_z,
48
const
double
&_w);
49
52
public
:
Vector4
(
const
Vector4
&_v);
53
54
56
public
:
virtual
~Vector4
();
57
61
public
:
double
Distance
(
const
Vector4
&_pt)
const
;
62
64
public
:
double
GetLength
()
const
;
65
68
public
:
double
GetSquaredLength
()
const
;
69
71
public
:
void
Normalize
();
72
78
public
:
void
Set
(
double
_x = 0,
double
_y = 0 ,
double
_z = 0,
79
double
_w = 0);
80
84
public
:
Vector4
&
operator =
(
const
Vector4
&_v);
85
88
public
:
Vector4
&
operator =
(
double
_value);
89
93
public
:
Vector4
operator+
(
const
Vector4
&_v)
const
;
94
98
public
:
const
Vector4
&
operator+=
(
const
Vector4
&_v);
99
103
public
:
Vector4
operator-
(
const
Vector4
&_v)
const
;
104
108
public
:
const
Vector4
&
operator-=
(
const
Vector4
&_v);
109
115
public
:
const
Vector4
operator/
(
const
Vector4
&_v)
const
;
116
122
public
:
const
Vector4
&
operator/=
(
const
Vector4
&_v);
123
129
public
:
const
Vector4
operator/
(
double
_v)
const
;
130
134
public
:
const
Vector4
&
operator/=
(
double
_v);
135
141
public
:
const
Vector4
operator*
(
const
Vector4
&_pt)
const
;
142
146
public
:
const
Vector4
operator*
(
const
Matrix4
&_m)
const
;
147
153
public
:
const
Vector4
&
operator*=
(
const
Vector4
&_pt);
154
158
public
:
const
Vector4
operator*
(
double
_v)
const
;
159
163
public
:
const
Vector4
&
operator*=
(
double
_v);
164
169
public
:
bool
operator ==
(
const
Vector4
&_pt)
const
;
170
175
public
:
bool
operator!=
(
const
Vector4
&_pt)
const
;
176
179
public
:
bool
IsFinite
()
const
;
180
183
public
:
double
operator[]
(
unsigned
int
_index)
const
;
184
186
public
:
double
x
;
187
189
public
:
double
y
;
190
192
public
:
double
z
;
193
195
public
:
double
w
;
196
201
public
:
friend
std::ostream &
operator<<
(std::ostream &_out,
202
const
gazebo::math::Vector4
&_pt)
203
{
204
_out << _pt.
x
<<
" "
<< _pt.
y
<<
" "
<< _pt.
z
<<
" "
<< _pt.
w
;
205
return
_out;
206
}
207
212
public
:
friend
std::istream &
operator >>
(std::istream &_in,
213
gazebo::math::Vector4
&_pt)
214
{
215
// Skip white spaces
216
_in.setf(std::ios_base::skipws);
217
_in >> _pt.
x
>> _pt.
y
>> _pt.
z
>> _pt.
w
;
218
return
_in;
219
}
220
};
222
}
223
}
224
#endif
225
226
227