18#include "glm/vec2.hpp"
19#include "glm/vec3.hpp"
20#include "glm/vec4.hpp"
21#include "glm/mat3x3.hpp"
22#include "glm/mat4x4.hpp"
23#include "glm/geometric.hpp"
24#include "glm/common.hpp"
25#include "glm/trigonometric.hpp"
26#include "glm/exponential.hpp"
27#include "glm/vector_relational.hpp"
29#include "glm/gtc/constants.hpp"
30#include "glm/gtc/matrix_transform.hpp"
31#include "glm/gtc/matrix_inverse.hpp"
32#include "glm/gtc/quaternion.hpp"
33#include "glm/gtc/epsilon.hpp"
34#include "glm/gtx/norm.hpp"
35#include "glm/gtx/perpendicular.hpp"
36#include "glm/gtx/quaternion.hpp"
37#include "glm/gtx/rotate_vector.hpp"
38#include "glm/gtx/spline.hpp"
39#include "glm/gtx/transform.hpp"
40#include "glm/gtx/vector_angle.hpp"
41#include "glm/gtx/scalar_multiplication.hpp"
42#include <glm/gtc/type_ptr.hpp>
48 return *
reinterpret_cast<const ofVec2f*
>(&v);
53 return *
reinterpret_cast<const ofVec3f*
>(&v);
58 return *
reinterpret_cast<const ofVec4f*
>(&v);
73 return *
reinterpret_cast<const glm::vec2*
>(&v);
78 return *
reinterpret_cast<const glm::vec3*
>(&v);
83 return *
reinterpret_cast<const glm::vec4*
>(&v);
88 return *
reinterpret_cast<const glm::mat4*
>(&v);
93 return *
reinterpret_cast<const glm::mat3*
>(&v);
97inline const glm::vec2 &
toGlm(
const glm::vec2 & v){
102inline const glm::vec3 &
toGlm(
const glm::vec3 & v){
107inline const glm::vec4 &
toGlm(
const glm::vec4 & v){
113 return glm::quat(q.
w(), glm::vec3(q.
x(), q.
y(), q.
z()));
117inline const glm::quat &
toGlm(
const glm::quat & q){
123 template <
typename T, precision P>
124 inline std::ostream&
operator<<(std::ostream& os,
const vec<3, T, P>& vec) {
125 os << vec.x <<
", " << vec.y <<
", " << vec.z;
130 template <
typename T, precision P>
131 inline std::istream&
operator>>(std::istream& is, vec<3, T, P>& vec) {
141 template <
typename T, precision P>
142 inline std::ostream&
operator<<(std::ostream& os,
const vec<2, T, P>& vec) {
143 os << vec.x <<
", " << vec.y;
148 template <
typename T, precision P>
149 inline std::istream&
operator>>(std::istream& is, vec<2, T, P>& vec) {
157 template <
typename T, precision P>
158 inline std::ostream&
operator<<(std::ostream& os,
const vec<4, T, P>& vec) {
159 os << vec.x <<
", " << vec.y <<
", " << vec.z <<
", " << vec.w;
164 template <
typename T, precision P>
165 inline std::istream&
operator>>(std::istream& is, vec<4, T, P>& vec) {
177 template <
typename T, precision P>
178 inline std::ostream&
operator<<(std::ostream& os,
const mat<3, 3, T, P>& mat) {
181 << mat[0][0] <<
", " << std::setw(w)
182 << mat[0][1] <<
", " << std::setw(w)
183 << mat[0][2] << std::endl;
186 << mat[1][0] <<
", " << std::setw(w)
187 << mat[1][1] <<
", " << std::setw(w)
188 << mat[1][2] << std::endl;
191 << mat[2][0] <<
", " << std::setw(w)
192 << mat[2][1] <<
", " << std::setw(w)
198 template <
typename T, precision P>
199 inline std::istream&
operator>>(std::istream& is, mat<3, 3, T, P>& mat) {
200 is >> mat[0][0]; is.ignore(2);
201 is >> mat[0][1]; is.ignore(2);
202 is >> mat[0][2]; is.ignore(1);
204 is >> mat[1][0]; is.ignore(2);
205 is >> mat[1][1]; is.ignore(2);
206 is >> mat[1][2]; is.ignore(1);
208 is >> mat[2][0]; is.ignore(2);
209 is >> mat[2][1]; is.ignore(2);
215 template <
typename T, precision P>
216 inline std::ostream&
operator<<(std::ostream& os,
const mat<4, 4, T, P>& mat) {
219 << mat[0][0] <<
", " << std::setw(w)
220 << mat[0][1] <<
", " << std::setw(w)
221 << mat[0][2] <<
", " << std::setw(w)
222 << mat[0][3] << std::endl;
225 << mat[1][0] <<
", " << std::setw(w)
226 << mat[1][1] <<
", " << std::setw(w)
227 << mat[1][2] <<
", " << std::setw(w)
228 << mat[1][3] << std::endl;
231 << mat[2][0] <<
", " << std::setw(w)
232 << mat[2][1] <<
", " << std::setw(w)
233 << mat[2][2] <<
", " << std::setw(w)
234 << mat[2][3] << std::endl;
237 << mat[3][0] <<
", " << std::setw(w)
238 << mat[3][1] <<
", " << std::setw(w)
239 << mat[3][2] <<
", " << std::setw(w)
245 template <
typename T, precision P>
246 inline std::istream&
operator>>(std::istream& is, mat<4, 4, T, P>& mat) {
247 is >> mat[0][0]; is.ignore(2);
248 is >> mat[0][1]; is.ignore(2);
249 is >> mat[0][2]; is.ignore(2);
250 is >> mat[0][3]; is.ignore(1);
252 is >> mat[1][0]; is.ignore(2);
253 is >> mat[1][1]; is.ignore(2);
254 is >> mat[1][2]; is.ignore(2);
255 is >> mat[1][3]; is.ignore(1);
257 is >> mat[2][0]; is.ignore(2);
258 is >> mat[2][1]; is.ignore(2);
259 is >> mat[2][2]; is.ignore(2);
260 is >> mat[2][3]; is.ignore(1);
262 is >> mat[3][0]; is.ignore(2);
263 is >> mat[3][1]; is.ignore(2);
264 is >> mat[3][2]; is.ignore(2);
270 template <
typename T, precision P>
271 inline std::ostream&
operator<<(std::ostream& os,
const qua<T, P>& q) {
272 os << q.w <<
", " << q.x <<
", " << q.y <<
", " << q.z;
278 template <
typename T, precision P>
279 inline std::istream&
operator>> (std::istream& is, qua<T, P>& q) {
293 return v1 + glm::vec3(v2);
298 return v1 - glm::vec3(v2);
303 return v1 * glm::vec3(v2);
308 return v1 / glm::vec3(v2);
337 return v1 + glm::vec2(v2);
342 return v1 - glm::vec2(v2);
347 return v1 * glm::vec2(v2);
352 return v1 / glm::vec2(v2);
A 3x3 Matrix.
Definition ofMatrix3x3.h:20
The ofMatrix4x4 is the big class of the math part of openFrameworks.
Definition ofMatrix4x4.h:58
Definition ofQuaternion.h:27
float & w()
Definition ofQuaternion.h:313
float & y()
Definition ofQuaternion.h:301
float & z()
Definition ofQuaternion.h:307
float & x()
Definition ofQuaternion.h:295
ofVec2f is a class for storing a two dimensional vector.
Definition ofVec2f.h:72
ofVec3f is a class for storing a three dimensional vector.
Definition ofVec3f.h:79
Definition ofVectorMath.h:121
std::ostream & operator<<(std::ostream &os, const vec< 3, T, P > &vec)
Definition ofVectorMath.h:124
std::istream & operator>>(std::istream &is, vec< 3, T, P > &vec)
Definition ofVectorMath.h:131
glm::vec3 operator+(const glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:292
glm::vec3 operator/(const glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:307
const ofVec2f & toOf(const glm::vec2 &v)
Definition ofVectorMath.h:47
glm::vec3 & operator/=(glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:330
glm::vec3 & operator*=(glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:324
glm::vec3 & operator+=(glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:312
const glm::vec2 & toGlm(const ofVec2f &v)
Definition ofVectorMath.h:72
glm::vec3 operator*(const glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:302
glm::vec3 & operator-=(glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:318
glm::vec3 operator-(const glm::vec3 &v1, const ofVec3f &v2)
Definition ofVectorMath.h:297