Vector2i.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  * 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 #ifndef GAZEBO_MATH_VECTOR2I_HH_
18 #define GAZEBO_MATH_VECTOR2I_HH_
19 
20 #include <math.h>
21 #include <iostream>
22 #include <fstream>
23 #include <ignition/math/Vector2.hh>
24 
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace math
30  {
33 
36  class GZ_MATH_VISIBLE Vector2i
37  {
39  public: Vector2i();
40 
44  public: Vector2i(const int &_x, const int &_y) GAZEBO_DEPRECATED(8.0);
45 
48  public: Vector2i(const Vector2i &_pt) GAZEBO_DEPRECATED(8.0);
49 
52  public: Vector2i(const ignition::math::Vector2i &_pt)
53  GAZEBO_DEPRECATED(8.0);
54 
56  public: virtual ~Vector2i();
57 
61  public: int Distance(const Vector2i &_pt) const;
62 
64  public: void Normalize();
65 
69  public: void Set(int _x, int _y);
70 
74  public: Vector2i Cross(const Vector2i &_pt) const;
75 
79  public: Vector2i &operator =(const Vector2i &_v);
80 
84  public: Vector2i &operator =(const ignition::math::Vector2i &_v);
85 
89  public: const Vector2i &operator =(int _value);
90 
94  public: Vector2i operator+(const Vector2i &_v) const;
95 
99  public: const Vector2i &operator+=(const Vector2i &_v);
100 
104  public: Vector2i operator-(const Vector2i &_v) const;
105 
109  public: const Vector2i &operator-=(const Vector2i &_v);
110 
115  public: const Vector2i operator/(const Vector2i &_v) const;
116 
121  public: const Vector2i &operator/=(const Vector2i &_v);
122 
127  public: const Vector2i operator/(int _v) const;
128 
133  public: const Vector2i &operator/=(int _v);
134 
139  public: const Vector2i operator*(const Vector2i &_v) const;
140 
145  public: const Vector2i &operator*=(const Vector2i &_v);
146 
150  public: const Vector2i operator*(int _v) const;
151 
155  public: const Vector2i &operator*=(int _v);
156 
160  public: bool operator ==(const Vector2i &_v) const;
161 
165  public: bool operator!=(const Vector2i &_v) const;
166 
169  public: bool IsFinite() const;
170 
173  public: int operator[](unsigned int _index) const;
174 
178  public: ignition::math::Vector2i Ign() const;
179 
181  public: int x;
182 
184  public: int y;
185 
190  public: friend std::ostream &operator<<(std::ostream &_out,
191  const gazebo::math::Vector2i &_pt)
192  {
193  _out << _pt.x << " " << _pt.y;
194  return _out;
195  }
196 
201  public: friend std::istream &operator>>(std::istream &_in,
203  {
204  // Skip white spaces
205  _in.setf(std::ios_base::skipws);
206  _in >> _pt.x >> _pt.y;
207  return _in;
208  }
209  };
210 
212  }
213 }
214 #endif
215 
216 
217 
Forward declarations for the common classes.
Definition: Animation.hh:33
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
Generic integer x, y vector.
Definition: Vector2i.hh:36
friend std::istream & operator>>(std::istream &_in, gazebo::math::Vector2i &_pt)
Stream extraction operator.
Definition: Vector2i.hh:201
friend std::ostream & operator<<(std::ostream &_out, const gazebo::math::Vector2i &_pt)
Stream insertion operator.
Definition: Vector2i.hh:190
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
int x
x data
Definition: Vector2i.hh:181
int y
y data
Definition: Vector2i.hh:184