zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Coordinate.hxx
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ZENI_COORDINATE_HXX
19 #define ZENI_COORDINATE_HXX
20 
21 #include <Zeni/Coordinate.h>
22 
23 // HXXed below
24 #include <Zeni/Vector2f.h>
25 #include <Zeni/Vector3f.h>
26 
27 namespace Zeni {
28 
30  : x(0), y(0)
31  {
32  }
33 
34  Point2i::Point2i(const int &x_, const int &y_)
35  : x(x_), y(y_)
36  {
37  }
38 
40  : x(int(rhs.x)), y(int(rhs.y))
41  {
42  }
43 
45  : x(rhs.x), y(rhs.y)
46  {
47  }
48 
50  : x(int(rhs.x)), y(int(rhs.y))
51  {
52  }
53 
55  : x(0.0f), y(0.0f)
56  {
57  }
58 
59  Point2f::Point2f(const float &x_, const float &y_)
60  : x(x_), y(y_)
61  {
62  }
63 
65  : x(float(rhs.x)), y(float(rhs.y))
66  {
67  }
68 
70  : x(float(rhs.x)), y(float(rhs.y))
71  {
72  }
73 
75  : x(rhs.x), y(rhs.y)
76  {
77  }
78 
80  : x(rhs.i), y(rhs.j)
81  {
82  }
83 
84  Vector2f Point2f::operator-(const Point2f &rhs) const {
85  return Vector2f(x - rhs.x, y - rhs.y);
86  }
87 
88  Point2f Point2f::operator+(const Vector2f &rhs) const {
89  return Point2f(x + rhs.i, y + rhs.j);
90  }
91 
92  Point2f Point2f::operator-(const Vector2f &rhs) const {
93  return Point2f(x - rhs.i, y - rhs.j);
94  }
95 
97  x += rhs.i;
98  y += rhs.j;
99  return *this;
100  }
101 
103  x -= rhs.i;
104  y -= rhs.j;
105  return *this;
106  }
107 
109  : x(0), y(0), z(0)
110  {
111  }
112 
113  Point3i::Point3i(const int &x_, const int &y_, const int &z_)
114  : x(x_), y(y_), z(z_)
115  {
116  }
117 
119  : x(rhs.x), y(rhs.y), z(0)
120  {
121  }
122 
124  : x(int(rhs.x)), y(int(rhs.y)), z(0)
125  {
126  }
127 
129  : x(int(rhs.x)), y(int(rhs.y)), z(int(rhs.z))
130  {
131  }
132 
134  : x(0.0f), y(0.0f), z(0.0f)
135  {
136  }
137 
138  Point3f::Point3f(const float &x_, const float &y_, const float &z_)
139  : x(x_), y(y_), z(z_)
140  {
141  }
142 
144  : x(float(rhs.x)), y(float(rhs.y)), z(0.0f)
145  {
146  }
147 
149  : x(rhs.x), y(rhs.y), z(0.0f)
150  {
151  }
152 
154  : x(float(rhs.x)), y(float(rhs.y)), z(float(rhs.z))
155  {
156  }
157 
159  : x(rhs.i), y(rhs.j), z(rhs.k)
160  {
161  }
162 
163  Vector3f Point3f::operator-(const Point3f &rhs) const {
164  return Vector3f(x - rhs.x, y - rhs.y, z - rhs.z);
165  }
166 
167  Point3f Point3f::operator+(const Vector3f &rhs) const {
168  return Point3f(x + rhs.i, y + rhs.j, z + rhs.k);
169  }
170 
171  Point3f Point3f::operator-(const Vector3f &rhs) const {
172  return Point3f(x - rhs.i, y - rhs.j, z - rhs.k);
173  }
174 
176  x += rhs.i;
177  y += rhs.j;
178  z += rhs.k;
179  return *this;
180  }
181 
183  x -= rhs.i;
184  y -= rhs.j;
185  z -= rhs.k;
186  return *this;
187  }
188 
189 }
190 
191 #include <Zeni/Vector2f.hxx>
192 #include <Zeni/Vector3f.hxx>
193 
194 #endif
Point3f & operator-=(const Vector3f &rhs)
Definition: Coordinate.hxx:182
GLclampf f
Definition: glew.h:3390
int32_t k
Definition: e_log.c:102
Vector3f operator-(const Point3f &rhs) const
Definition: Coordinate.hxx:163
EGLSurface EGLint x
Definition: eglext.h:293
Point2f & operator-=(const Vector2f &rhs)
Definition: Coordinate.hxx:102
int32_t j
Definition: e_log.c:102
A 3D Point represented with floats.
Definition: Coordinate.h:133
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
A 3D Point represented with integers.
Definition: Coordinate.h:121
int
Definition: SDL_systhread.c:37
EGLSurface EGLint EGLint y
Definition: eglext.h:293
Point3f & operator+=(const Vector3f &rhs)
Definition: Coordinate.hxx:175
Point2f & operator+=(const Vector2f &rhs)
Definition: Coordinate.hxx:96
Vector2f operator-(const Point2f &rhs) const
Definition: Coordinate.hxx:84
Point2f operator+(const Vector2f &rhs) const
Definition: Coordinate.hxx:88
GLint GLint GLint GLint z
Definition: gl2ext.h:1214
Point3f operator+(const Vector3f &rhs) const
Definition: Coordinate.hxx:167
int i
Definition: pngrutil.c:1377
A 2D Point represented with floats.
Definition: Coordinate.h:98
A 2-Space Vector Class.
Definition: Vector2f.h:41
A 2D Point represented with integers.
Definition: Coordinate.h:85