Vector4.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Open Source Robotics Foundation
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 <ignition/math/Vector4.hh>
28 
29 #include "gazebo/math/Matrix4.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace math
35  {
38 
41  class GZ_MATH_VISIBLE Vector4
42  {
44  public: Vector4() GAZEBO_DEPRECATED(8.0);
45 
51  public: Vector4(const double &_x, const double &_y, const double &_z,
52  const double &_w) GAZEBO_DEPRECATED(8.0);
53 
56  public: Vector4(const Vector4 &_v) GAZEBO_DEPRECATED(8.0);
57 
60  public: Vector4(const ignition::math::Vector4d &_v)
61  GAZEBO_DEPRECATED(8.0);
62 
64  public: virtual ~Vector4();
65 
69  public: double Distance(const Vector4 &_pt) const;
70 
72  public: double GetLength() const;
73 
76  public: double GetSquaredLength() const;
77 
79  public: void Normalize();
80 
86  public: void Set(double _x = 0, double _y = 0 , double _z = 0,
87  double _w = 0);
88 
91  public: ignition::math::Vector4d Ign() const;
92 
96  public: Vector4 &operator=(const ignition::math::Vector4d &_v);
97 
101  public: Vector4 &operator =(const Vector4 &_v);
102 
105  public: Vector4 &operator =(double _value);
106 
110  public: Vector4 operator+(const Vector4 &_v) const;
111 
115  public: const Vector4 &operator+=(const Vector4 &_v);
116 
120  public: Vector4 operator-(const Vector4 &_v) const;
121 
125  public: const Vector4 &operator-=(const Vector4 &_v);
126 
132  public: const Vector4 operator/(const Vector4 &_v) const;
133 
139  public: const Vector4 &operator/=(const Vector4 &_v);
140 
146  public: const Vector4 operator/(double _v) const;
147 
151  public: const Vector4 &operator/=(double _v);
152 
158  public: const Vector4 operator*(const Vector4 &_pt) const;
159 
163  public: const Vector4 operator*(const Matrix4 &_m) const;
164 
170  public: const Vector4 &operator*=(const Vector4 &_pt);
171 
175  public: const Vector4 operator*(double _v) const;
176 
180  public: const Vector4 &operator*=(double _v);
181 
186  public: bool operator ==(const Vector4 &_pt) const;
187 
192  public: bool operator!=(const Vector4 &_pt) const;
193 
196  public: bool IsFinite() const;
197 
200  public: double operator[](unsigned int _index) const;
201 
203  public: double x;
204 
206  public: double y;
207 
209  public: double z;
210 
212  public: double w;
213 
218  public: friend std::ostream &operator<<(std::ostream &_out,
219  const gazebo::math::Vector4 &_pt)
220  {
221  _out << _pt.x << " " << _pt.y << " " << _pt.z << " " << _pt.w;
222  return _out;
223  }
224 
229  public: friend std::istream &operator >> (std::istream &_in,
231  {
232  // Skip white spaces
233  _in.setf(std::ios_base::skipws);
234  _in >> _pt.x >> _pt.y >> _pt.z >> _pt.w;
235  return _in;
236  }
237  };
239  }
240 }
241 #endif
242 
243 
244 
static const double GAZEBO_DEPRECATED(8.0) MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:140
friend std::ostream & operator<<(std::ostream &_out, const gazebo::math::Vector4 &_pt)
Stream insertion operator.
Definition: Vector4.hh:218
A 3x3 matrix class.
Definition: Matrix4.hh:40
double Generic x, y, z, w vector
Definition: Vector4.hh:41
double y
Y value.
Definition: Vector4.hh:206
double z
Z value.
Definition: Vector4.hh:209
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
double w
W value.
Definition: Vector4.hh:212
double x
X value.
Definition: Vector4.hh:203