zenilib: zenilib/jni/external/zenilib/zeni/Zeni/Coordinate.hxx Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
29 Point2i::Point2i()
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
39 Point2i::Point2i(const Point2f &rhs)
40 : x(int(rhs.x)), y(int(rhs.y))
41 {
42 }
43
44 Point2i::Point2i(const Point3i &rhs)
45 : x(rhs.x), y(rhs.y)
46 {
47 }
48
49 Point2i::Point2i(const Point3f &rhs)
50 : x(int(rhs.x)), y(int(rhs.y))
51 {
52 }
53
54 Point2f::Point2f()
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
64 Point2f::Point2f(const Point2i &rhs)
65 : x(float(rhs.x)), y(float(rhs.y))
66 {
67 }
68
69 Point2f::Point2f(const Point3i &rhs)
70 : x(float(rhs.x)), y(float(rhs.y))
71 {
72 }
73
74 Point2f::Point2f(const Point3f &rhs)
75 : x(rhs.x), y(rhs.y)
76 {
77 }
78
79 Point2f::Point2f(const Vector2f &rhs)
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
96 Point2f & Point2f::operator+=(const Vector2f &rhs) {
97 x += rhs.i;
98 y += rhs.j;
99 return *this;
100 }
101
102 Point2f & Point2f::operator-=(const Vector2f &rhs) {
103 x -= rhs.i;
104 y -= rhs.j;
105 return *this;
106 }
107
108 Point3i::Point3i()
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
118 Point3i::Point3i(const Point2i &rhs)
119 : x(rhs.x), y(rhs.y), z(0)
120 {
121 }
122
123 Point3i::Point3i(const Point2f &rhs)
124 : x(int(rhs.x)), y(int(rhs.y)), z(0)
125 {
126 }
127
128 Point3i::Point3i(const Point3f &rhs)
129 : x(int(rhs.x)), y(int(rhs.y)), z(int(rhs.z))
130 {
131 }
132
133 Point3f::Point3f()
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
143 Point3f::Point3f(const Point2i &rhs)
144 : x(float(rhs.x)), y(float(rhs.y)), z(0.0f)
145 {
146 }
147
148 Point3f::Point3f(const Point2f &rhs)
149 : x(rhs.x), y(rhs.y), z(0.0f)
150 {
151 }
152
153 Point3f::Point3f(const Point3i &rhs)
154 : x(float(rhs.x)), y(float(rhs.y)), z(float(rhs.z))
155 {
156 }
157
158 Point3f::Point3f(const Vector3f &rhs)
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
175 Point3f & Point3f::operator+=(const Vector3f &rhs) {
176 x += rhs.i;
177 y += rhs.j;
178 z += rhs.k;
179 return *this;
180 }
181
182 Point3f & Point3f::operator-=(const Vector3f &rhs) {
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
Zeni::Point3f::Point3f
Point3f()
Definition: Coordinate.hxx:133
Zeni::Point3f::operator-=
Point3f & operator-=(const Vector3f &rhs)
Definition: Coordinate.hxx:182
Vector3f.hxx
f
GLclampf f
Definition: glew.h:3390
k
int32_t k
Definition: e_log.c:102
Zeni::Point3f::operator-
Vector3f operator-(const Point3f &rhs) const
Definition: Coordinate.hxx:163
x
EGLSurface EGLint x
Definition: eglext.h:293
Zeni::Point2f::operator-=
Point2f & operator-=(const Vector2f &rhs)
Definition: Coordinate.hxx:102
j
int32_t j
Definition: e_log.c:102
Zeni::Point3f
A 3D Point represented with floats.
Definition: Coordinate.h:133
Zeni::Point3i::Point3i
Point3i()
Definition: Coordinate.hxx:108
Zeni::Point2f::y
float y
Definition: Coordinate.h:117
Coordinate.h
Vector3f.h
Zeni::Vector3f
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
Zeni::Point2i::Point2i
Point2i()
Definition: Coordinate.hxx:29
Zeni::Point3i
A 3D Point represented with integers.
Definition: Coordinate.h:121
int
int
Definition: SDL_systhread.c:37
Zeni::Point3f::y
float y
Definition: Coordinate.h:152
Zeni::Point2f::Point2f
Point2f()
Definition: Coordinate.hxx:54
Zeni::Vector3f::k
float k
Definition: Vector3f.h:119
Zeni::Point2f::x
float x
Definition: Coordinate.h:117
Zeni::Point3f::z
float z
Definition: Coordinate.h:152
y
EGLSurface EGLint EGLint y
Definition: eglext.h:293
Zeni::Vector3f::j
float j
Definition: Vector3f.h:115
Zeni::Point3f::operator+=
Point3f & operator+=(const Vector3f &rhs)
Definition: Coordinate.hxx:175
Zeni::Point2f::operator+=
Point2f & operator+=(const Vector2f &rhs)
Definition: Coordinate.hxx:96
Zeni::Point2f::operator-
Vector2f operator-(const Point2f &rhs) const
Definition: Coordinate.hxx:84
Zeni::Point2f::operator+
Point2f operator+(const Vector2f &rhs) const
Definition: Coordinate.hxx:88
z
GLint GLint GLint GLint z
Definition: gl2ext.h:1214
Zeni::Point3f::operator+
Point3f operator+(const Vector3f &rhs) const
Definition: Coordinate.hxx:167
Zeni::Vector2f::i
float i
Definition: Vector2f.h:87
Vector2f.h
i
int i
Definition: pngrutil.c:1377
Vector2f.hxx
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
Zeni::Vector3f::i
float i
Definition: Vector3f.h:111
Zeni::Vector2f::j
float j
Definition: Vector2f.h:91
Zeni::Point3f::x
float x
Definition: Coordinate.h:152
Zeni::Vector2f
A 2-Space Vector Class.
Definition: Vector2f.h:41
Zeni::Point2i
A 2D Point represented with integers.
Definition: Coordinate.h:85