zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Coordinate.h
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 
72 #ifndef ZENI_COORDINATE_H
73 #define ZENI_COORDINATE_H
74 
75 #include <Zeni/Vector2f.h>
76 #include <Zeni/Vector3f.h>
77 
78 namespace Zeni {
79 
80  struct ZENI_DLL Point2i;
81  struct ZENI_DLL Point2f;
82  struct ZENI_DLL Point3i;
83  struct ZENI_DLL Point3f;
84 
85  struct ZENI_DLL Point2i {
86  inline Point2i();
87  inline Point2i(const int &x_, const int &y_);
88  inline explicit Point2i(const Point2f &rhs);
89  inline explicit Point2i(const Point3i &rhs);
90  inline explicit Point2i(const Point3f &rhs);
91 
92  Point2i interpolate_to(const float &rhs_part, const Point2i &rhs) const;
93 
95  static const Sint32 z;
96  };
97 
98  struct ZENI_DLL Point2f {
99  inline Point2f();
100  inline Point2f(const float &x_, const float &y_);
101  inline explicit Point2f(const Point2i &rhs);
102  inline explicit Point2f(const Point3i &rhs);
103  inline explicit Point2f(const Point3f &rhs);
104  inline Point2f(const Vector2f &rhs);
105 
106  Point2f interpolate_to(const float &rhs_part, const Point2f &rhs) const;
107 
108  // Subtraction
109  inline Vector2f operator-(const Point2f &rhs) const;
110 
111  // Vector3f addition
112  inline Point2f operator+(const Vector2f &rhs) const;
113  inline Point2f operator-(const Vector2f &rhs) const;
114  inline Point2f & operator+=(const Vector2f &rhs);
115  inline Point2f & operator-=(const Vector2f &rhs);
116 
117  float x, y;
118  static const float z;
119  };
120 
121  struct ZENI_DLL Point3i {
122  inline Point3i();
123  inline Point3i(const int &x_, const int &y_, const int &z_);
124  inline explicit Point3i(const Point2i &rhs);
125  inline explicit Point3i(const Point2f &rhs);
126  inline explicit Point3i(const Point3f &rhs);
127 
128  Point3i interpolate_to(const float &rhs_part, const Point3i &rhs) const;
129 
130  Sint32 x, y, z;
131  };
132 
133  struct ZENI_DLL Point3f {
134  inline Point3f();
135  inline Point3f(const float &x_, const float &y_, const float &z_);
136  inline explicit Point3f(const Point2i &rhs);
137  inline explicit Point3f(const Point2f &rhs);
138  inline explicit Point3f(const Point3i &rhs);
139  inline Point3f(const Vector3f &rhs);
140 
141  Point3f interpolate_to(const float &rhs_part, const Point3f &rhs) const;
142 
143  // Subtraction
144  inline Vector3f operator-(const Point3f &rhs) const;
145 
146  // Vector3f addition
147  inline Point3f operator+(const Vector3f &rhs) const;
148  inline Point3f operator-(const Vector3f &rhs) const;
149  inline Point3f & operator+=(const Vector3f &rhs);
150  inline Point3f & operator-=(const Vector3f &rhs);
151 
152  float x, y, z;
153  };
154 
155  ZENI_DLL std::ostream & serialize(std::ostream &os, const Point2i &value);
156  ZENI_DLL std::ostream & serialize(std::ostream &os, const Point2f &value);
157  ZENI_DLL std::ostream & serialize(std::ostream &os, const Point3i &value);
158  ZENI_DLL std::ostream & serialize(std::ostream &os, const Point3f &value);
159  ZENI_DLL std::istream & unserialize(std::istream &is, Point2i &value);
160  ZENI_DLL std::istream & unserialize(std::istream &is, Point2f &value);
161  ZENI_DLL std::istream & unserialize(std::istream &is, Point3i &value);
162  ZENI_DLL std::istream & unserialize(std::istream &is, Point3f &value);
163 
164 }
165 
166 #endif
int32_t Sint32
A signed 32-bit integer type.
Definition: SDL_stdinc.h:141
EGLSurface EGLint x
Definition: eglext.h:293
static const Sint32 z
Definition: Coordinate.h:95
TiXmlString operator+(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.cpp:86
std::istream & unserialize(std::istream &is, Color &value)
Definition: Color.cpp:72
std::ostream & serialize(std::ostream &os, const Color &value)
Definition: Color.cpp:68
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
static const float z
Definition: Coordinate.h:118
EGLSurface EGLint EGLint y
Definition: eglext.h:293
EGLSurface EGLint void ** value
Definition: eglext.h:301
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