Kale
Loading...
Searching...
No Matches
Vector.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Rishi Challa
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 WITHOUT 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#pragma once
18
20
21#include <cmath>
22#include <algorithm>
23#include <ostream>
24#include <type_traits>
25#include <limits>
26
27#include <nlohmann/json.hpp>
28
29namespace Kale {
30
35 using JSON = nlohmann::json;
36
40 template <typename T>
41 class Vector2 {
42 public:
43 T x, y;
44
45 Vector2() : x(0), y(0) {}
46 Vector2(T x, T y) : x(x), y(y) {}
47 Vector2(T v[2]) : x(v[0]), y(v[1]) {}
48
49 void operator=(T n) {
50 x = n;
51 y = n;
52 }
53 void operator=(T v[2]) {
54 x = v[0];
55 y = v[1];
56 }
57
59 x += o.x;
60 y += o.y;
61 }
63 x -= o.x;
64 y -= o.y;
65 }
67 x *= o.x;
68 y *= o.y;
69 }
71 x /= o.x;
72 y /= o.y;
73 }
74
75 void operator+=(T v) {
76 x += v;
77 y += v;
78 }
79 void operator-=(T v) {
80 x -= v;
81 y -= v;
82 }
83 void operator*=(T v) {
84 x *= v;
85 y *= v;
86 }
87 void operator/=(T v) {
88 x /= v;
89 y /= v;
90 }
91
92 Vector2<T> operator-() const { return {-x, -y}; };
93
94 Vector2<T> operator+(Vector2<T> o) const { return Vector2<T>(x + o.x, y + o.y); }
95 Vector2<T> operator-(Vector2<T> o) const { return Vector2<T>(x - o.x, y - o.y); }
96 Vector2<T> operator*(Vector2<T> o) const { return Vector2<T>(x * o.x, y * o.y); }
97 Vector2<T> operator/(Vector2<T> o) const { return Vector2<T>(x / o.x, y / o.y); }
98
99 Vector2<T> operator+(T v) const { return Vector2<T>(x + v, y + v); }
100 Vector2<T> operator-(T v) const { return Vector2<T>(x - v, y - v); }
101 Vector2<T> operator*(T v) const { return Vector2<T>(x * v, y * v); }
102 Vector2<T> operator/(T v) const { return Vector2<T>(x / v, y / v); }
103
104 friend Vector2<T> operator+(float n, Vector2<T> v) { return Vector2<T>(n + v.x, n + v.y); }
105 friend Vector2<T> operator-(float n, Vector2<T> v) { return Vector2<T>(n - v.x, n - v.y); }
106 friend Vector2<T> operator*(float n, Vector2<T> v) { return Vector2<T>(n * v.x, n * v.y); }
107 friend Vector2<T> operator/(float n, Vector2<T> v) { return Vector2<T>(n / v.x, n / v.y); }
108
109 bool operator>(Vector2<T> o) const { return x > o.x && y > o.y; }
110 bool operator<(Vector2<T> o) const { return x < o.x && y < o.y; }
111 bool operator<=(Vector2<T> o) const { return x <= o.x && y <= o.y; }
112 bool operator>=(Vector2<T> o) const { return x >= o.x && y >= o.y; }
113 template <typename A = T> typename std::enable_if<std::is_integral<A>::value, bool>::type operator==(Vector2<T> o) const {
114 return x == o.x && y == o.y;
115 }
116 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, bool>::type operator==(Vector2<T> o) const {
117 return isFloatingEqual(x, o.x) && isFloatingEqual(y, o.y);
118 }
119 bool operator!=(Vector2<T> o) const { return !operator==(o); }
120
121 T dot(Vector2<T> o) const { return o.x * x + o.y * y; }
122 T cross(Vector2<T> o) const { return x * o.y - y * o.x; }
123 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, T>::type magnitude() const {
124 return sqrt(x * x + y * y);
125 }
126
127 Vector2<T> clamp(T minX, T maxX, T minY, T maxY) const {
128 return Vector2<T>(std::clamp(x, minX, maxX), std::clamp(y, minY, maxY));
129 }
131 return Vector2<T>(std::clamp(x, min.x, max.x), std::clamp(y, min.y, max.y));
132 }
133
134 void clampTo(T minX, T maxX, T minY, T maxY) {
135 x = std::clamp(x, minX, maxX);
136 y = std::clamp(y, minY, maxY);
137 }
139 x = std::clamp(x, min.x, max.x);
140 y = std::clamp(y, min.y, max.y);
141 }
142
143 template <typename A>
144 Vector2<A> cast() const {
145 return Vector2<A>(static_cast<A>(x), static_cast<A>(y));
146 }
147
148 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, Vector2<T>>::type unit() const {
149 return *this / magnitude();
150 }
151 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, float>::type dist(Vector2<T> o) const {
152 return (*this - o).magnitude();
153 }
154
156 return {x + o.y - y, y - o.x + x};
157 }
159 float k = dot(o) / o.dot(o);
160 return {k * o.x, k * o.y};
161 }
162
163 float signedAngle(Vector2<T> to) const { return atan2(x * to.y - y * to.x, x * to.x + y * to.y); }
164 Vector2<T> rotateClockwise() const { return Vector2<T>{y, -x}; }
166 Vector2<T> normalized() const { float m = magnitude(); return Vector2<T>{x / m, y / m}; }
167
168 Vector2<T> xy() const { return {x, y}; }
169 Vector2<T> yx() const { return {y, x}; }
170
171 static Vector2<T> one() { return {1, 1}; }
172 static Vector2<T> zero() { return {0, 0}; }
173 static Vector2<T> right() { return {1, 0}; }
174 static Vector2<T> up() { return {0, 1}; }
175 static Vector2<T> max() { return {std::numeric_limits<T>::max(), std::numeric_limits<T>::max()}; }
176 static Vector2<T> min() { return {std::numeric_limits<T>::min(), std::numeric_limits<T>::min()}; }
177
178 static Vector2<T> random(T min, T max) { return {randomRange<T>(min, max), randomRange<T>(min, max)}; }
179 static Vector2<T> random(T minX, T maxX, T minY, T maxY) { return {randomRange<T>(minX, maxX), randomRange<T>(minY, maxY)}; }
180 };
181
185 template <typename T>
186 class Vector3 {
187 public:
188 T x, y, z;
189
190 Vector3() : x(0), y(0), z(0) {}
191 Vector3(T x, T y, T z) : x(x), y(y), z(z) {}
192 Vector3(T v[3]) : x(v[0]), y(v[1]), z(v[2]) {}
193
194 Vector3(Vector2<T> v, T z) : x(v.x), y(v.y), z(z) {}
195 Vector3(T x, Vector2<T> v) : x(x), y(v.x), z(v.y) {}
196
197 void operator=(T n) {
198 x = n;
199 y = n;
200 z = n;
201 }
202 void operator=(T v[3]) {
203 x = v[0];
204 y = v[1];
205 z = v[2];
206 }
207
209 x += o.x;
210 y += o.y;
211 z += o.z;
212 }
214 x -= o.x;
215 y -= o.y;
216 z -= o.z;
217 }
219 x *= o.x;
220 y *= o.y;
221 z *= o.z;
222 }
224 x /= o.x;
225 y /= o.y;
226 z /= o.z;
227 }
228
229 void operator+=(T v) {
230 x += v;
231 y += v;
232 z += v;
233 }
234 void operator-=(T v) {
235 x -= v;
236 y -= v;
237 z -= v;
238 }
239 void operator*=(T v) {
240 x *= v;
241 y *= v;
242 z *= v;
243 }
244 void operator/=(T v) {
245 x /= v;
246 y /= v;
247 z /= v;
248 }
249
250 Vector3<T> operator-() const { return {-x, -y, -z}; };
251
252 Vector3<T> operator+(Vector3<T> o) const { return Vector3<T>(x + o.x, y + o.y, z + o.z); }
253 Vector3<T> operator-(Vector3<T> o) const { return Vector3<T>(x - o.x, y - o.y, z - o.z); }
254 Vector3<T> operator*(Vector3<T> o) const { return Vector3<T>(x * o.x, y * o.y, z * o.z); }
255 Vector3<T> operator/(Vector3<T> o) const { return Vector3<T>(x / o.x, y / o.y, z / o.z); }
256
257 Vector3<T> operator+(T v) const { return Vector3<T>(x + v, y + v, z + v); }
258 Vector3<T> operator-(T v) const { return Vector3<T>(x - v, y - v, z - v); }
259 Vector3<T> operator*(T v) const { return Vector3<T>(x * v, y * v, z * v); }
260 Vector3<T> operator/(T v) const { return Vector3<T>(x / v, y / v, z / v); }
261
262 friend Vector3<T> operator+(float n, Vector3<T> v) { return Vector3<T>(n + v.x, n + v.y, n + v.z); }
263 friend Vector3<T> operator-(float n, Vector3<T> v) { return Vector3<T>(n - v.x, n - v.y, n - v.z); }
264 friend Vector3<T> operator*(float n, Vector3<T> v) { return Vector3<T>(n * v.x, n * v.y, n * v.z); }
265 friend Vector3<T> operator/(float n, Vector3<T> v) { return Vector3<T>(n / v.x, n / v.y, n / v.z); }
266
267 bool operator>(Vector3<T> o) const { return x > o.x && y > o.y && z > o.z; }
268 bool operator<(Vector3<T> o) const { return x < o.x && y < o.y && z < o.z; }
269 bool operator>=(Vector3<T> o) const { return x >= o.x && y >= o.y && z >= o.z; }
270 bool operator<=(Vector3<T> o) const { return x <= o.x && y <= o.y && z <= o.z; }
271 template <typename A = T> typename std::enable_if<std::is_integral<A>::value, bool>::type operator==(Vector3<T> o) const {
272 return x == o.x && y == o.y && z == o.z;
273 }
274 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, bool>::type operator==(Vector3<T> o) const {
275 return isFloatingEqual(x, o.x) && isFloatingEqual(y, o.y) && isFloatingEqual(z, o.z);
276 }
277 bool operator!=(Vector3<T> o) const { return !operator==(o); }
278
279 T dot(Vector3<T> o) const { return o.x * x + o.y * y + o.z * z; }
280 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, T>::type magnitude() const {
281 return sqrt(x * x + y * y + z * z);
282 }
283 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, float>::type dist(Vector3<T> o) const {
284 return (*this - o).magnitude();
285 }
286
287 Vector3<T> clamp(T minX, T maxX, T minY, T maxY, T minZ, T maxZ) const {
288 return Vector3<T>(std::clamp(x, minX, maxX), std::clamp(y, minY, maxY), std::clamp(z, minZ, maxZ));
289 }
291 return Vector3<T>(std::clamp(x, min.x, max.x), std::clamp(y, min.y, max.y), std::clamp(z, min.z, max.z));
292 }
293
294 void clampTo(T minX, T maxX, T minY, T maxY, T minZ, T maxZ) {
295 x = std::clamp(x, minX, maxX);
296 y = std::clamp(y, minY, maxY);
297 z = std::clamp(z, minZ, maxZ);
298 }
300 x = std::clamp(x, min.x, max.x);
301 y = std::clamp(y, min.y, max.y);
302 z = std::clamp(z, min.z, max.z);
303 }
304
305 template <typename A> Vector3<A> cast() const {
306 return Vector3<A>(static_cast<A>(x), static_cast<A>(y), static_cast<A>(z));
307 }
308
309 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, Vector3<T>>::type unit() const {
310 return *this / magnitude();
311 }
312
313 Vector2<T> xy() const { return {x, y}; }
314 Vector2<T> xz() const { return {x, z}; }
315 Vector2<T> yx() const { return {y, x}; }
316 Vector2<T> yz() const { return {y, z}; }
317 Vector2<T> zx() const { return {z, x}; }
318 Vector2<T> zy() const { return {z, y}; }
319
320 Vector3<T> xyz() const { return {x, y, z}; }
321 Vector3<T> xzy() const { return {x, z, y}; }
322 Vector3<T> yxz() const { return {y, x, z}; }
323 Vector3<T> yzx() const { return {y, z, x}; }
324 Vector3<T> zxy() const { return {z, x, y}; }
325 Vector3<T> zyx() const { return {z, y, x}; }
326
327 static Vector3<T> zero() { return {0, 0, 0}; }
328 static Vector3<T> one() { return {1, 1, 1}; }
329 static Vector3<T> right() { return {1, 0, 0}; }
330 static Vector3<T> up() { return {0, 1, 0}; }
331 static Vector3<T> front() { return {0, 0, 1}; }
332 static Vector3<T> max() { return {std::numeric_limits<T>::max(), std::numeric_limits<T>::max(), std::numeric_limits<T>::max()}; }
333 static Vector3<T> min() { return {std::numeric_limits<T>::min(), std::numeric_limits<T>::min(), std::numeric_limits<T>::min()}; }
334
335 static Vector3<T> random(T min, T max) { return {randomRange<T>(min, max), randomRange<T>(min, max), randomRange<T>(min, max)}; }
336 static Vector3<T> random(T minX, T maxX, T minY, T maxY, T minZ, T maxZ) {
337 return {randomRange<T>(minX, maxX), randomRange<T>(minY, maxY), randomRange<T>(minZ, maxZ)};
338 }
339};
340
344 template <typename T>
345 class Vector4 {
346 public:
347 T x, y, z, w;
348
349 template<typename U = T, typename = typename std::enable_if<std::is_same<U, float>::value>::type>
350 Vector4(float r, float g, float b) : x(r/255.0f), y(g/255.0f), z(b/255.0f), w(1.0f) {}
351
352 template<typename U = T, typename = typename std::enable_if<std::is_same<U, float>::value>::type>
353 Vector4(int hex) : w(1.0f) {
354 x = ((hex >> 16) & 0xFF) / 255.0f;
355 y = ((hex >> 8) & 0xFF) / 255.0f;
356 z = (hex & 0xFF) / 255.0f;
357 }
358
359 template<typename U = T, typename = typename std::enable_if<std::is_same<U, float>::value>::type>
360 Vector4(int hex, float alpha) : w(alpha) {
361 x = ((hex >> 16) & 0xFF) / 255.0f;
362 y = ((hex >> 8) & 0xFF) / 255.0f;
363 z = (hex & 0xFF) / 255.0f;
364 }
365
366 Vector4() : x(0), y(0), z(0), w(0) {}
367 Vector4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
368 Vector4(T v[4]) : x(v[0]), y(v[1]), z(v[2]), w(v[3]) {}
369
370 Vector4(Vector2<T> v, T z, T w) : x(v.x), y(v.y), z(z), w(w) {}
371 Vector4(T x, Vector2<T> v, T w) : x(x), y(v.x), z(v.y), w(w) {}
372 Vector4(T x, T y, Vector2<T> v) : x(x), y(y), z(v.x), w(v.y) {}
373
374 Vector4(Vector3<T> v, T w) : x(v.x), y(v.y), z(v.z), w(w) {}
375 Vector4(T x, Vector3<T> v) : x(x), y(v.x), z(v.y), w(v.z) {}
376
377 void operator=(T n) {
378 x = n;
379 y = n;
380 z = n;
381 w = n;
382 }
383 void operator=(T v[4]) {
384 x = v[0];
385 y = v[1];
386 z = v[2];
387 w = v[3];
388 }
389
391 x += o.x;
392 y += o.y;
393 z += o.z;
394 w += o.w;
395 }
397 x -= o.x;
398 y -= o.y;
399 z -= o.z;
400 w -= o.w;
401 }
403 x *= o.x;
404 y *= o.y;
405 z *= o.z;
406 w *= o.w;
407 }
409 x /= o.x;
410 y /= o.y;
411 z /= o.z;
412 w /= o.w;
413 }
414
415 void operator+=(T v) {
416 x += v;
417 y += v;
418 z += v;
419 w += v;
420 }
421 void operator-=(T v) {
422 x -= v;
423 y -= v;
424 z -= v;
425 w -= v;
426 }
427 void operator*=(T v) {
428 x *= v;
429 y *= v;
430 z *= v;
431 w *= v;
432 }
433 void operator/=(T v) {
434 x /= v;
435 y /= v;
436 z /= v;
437 w /= v;
438 }
439
440 Vector4<T> operator-() const { return {-x, -y, -z, -w}; };
441
442 Vector4<T> operator+(Vector4<T> o) const { return Vector4<T>(x + o.x, y + o.y, z + o.z, w + o.w); }
443 Vector4<T> operator-(Vector4<T> o) const { return Vector4<T>(x - o.x, y - o.y, z - o.z, w - o.w); }
444 Vector4<T> operator*(Vector4<T> o) const { return Vector4<T>(x * o.x, y * o.y, z * o.z, w * o.w); }
445 Vector4<T> operator/(Vector4<T> o) const { return Vector4<T>(x / o.x, y / o.y, z / o.z, w / o.w); }
446
447 Vector4<T> operator+(T v) const { return Vector4<T>(x + v, y + v, z + v, w + v); }
448 Vector4<T> operator-(T v) const { return Vector4<T>(x - v, y - v, z - v, w - v); }
449 Vector4<T> operator*(T v) const { return Vector4<T>(x * v, y * v, z * v, w * v); }
450 Vector4<T> operator/(T v) const { return Vector4<T>(x / v, y / v, z / v, w / v); }
451
452 friend Vector4<T> operator+(float n, Vector4<T> v) { return Vector4<T>(n + v.x, n + v.y, n + v.z, n + v.w); }
453 friend Vector4<T> operator-(float n, Vector4<T> v) { return Vector4<T>(n - v.x, n - v.y, n - v.z, n - v.w); }
454 friend Vector4<T> operator*(float n, Vector4<T> v) { return Vector4<T>(n * v.x, n * v.y, n * v.z, n * v.w); }
455 friend Vector4<T> operator/(float n, Vector4<T> v) { return Vector4<T>(n / v.x, n / v.y, n / v.z, n / v.w); }
456
457 bool operator>(Vector4<T> o) const { return x > o.x && y > o.y && z > o.z && w > o.w; }
458 bool operator<(Vector4<T> o) const { return x < o.x && y < o.y && z < o.z && w < o.w; }
459 bool operator>=(Vector4<T> o) const { return x >= o.x && y >= o.y && z >= o.z && w >= o.w; }
460 bool operator<=(Vector4<T> o) const { return x <= o.x && y <= o.y && z <= o.z && w <= o.w; }
461 template <typename A = T> typename std::enable_if<std::is_integral<A>::value, bool>::type operator==(Vector4<T> o) const {
462 return x == o.x && y == o.y && z == o.z && w == o.w;
463 }
464 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, bool>::type operator==(Vector4<T> o) const {
465 return isFloatingEqual(x, o.x) && isFloatingEqual(y, o.y) && isFloatingEqual(z, o.z) && isFloatingEqual(w, o.w);
466 }
467 bool operator!=(Vector4<T> o) const { return !operator==(o); }
468
469 T dot(Vector4<T> o) const { return o.x * x + o.y * y + o.z * z + o.w * w; }
470 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, T>::type magnitude() const {
471 return sqrt(x * x + y * y + z * z + w * w);
472 }
473
474 Vector4<T> clamp(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW) const {
475 return Vector4<T>(std::clamp(x, minX, maxX), std::clamp(y, minY, maxY),
476 std::clamp(z, minZ, maxZ), std::clamp(w, minW, maxW));
477 }
479 return Vector4<T>(std::clamp(x, min.x, max.x), std::clamp(y, min.y, max.y),
480 std::clamp(z, min.z, max.z), std::clamp(w, min.w, max.w));
481 }
482
483 void clampTo(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW) {
484 x = std::clamp(x, minX, maxX);
485 y = std::clamp(y, minY, maxY);
486 z = std::clamp(z, minZ, maxZ);
487 w = std::clamp(w, minW, maxW);
488 }
490 x = std::clamp(x, min.x, max.x);
491 y = std::clamp(y, min.y, max.y);
492 z = std::clamp(z, min.z, max.z);
493 w = std::clamp(w, min.w, max.w);
494 }
495
496 template <typename A> Vector4<A> cast() const {
497 return Vector4<A>(static_cast<A>(x), static_cast<A>(y), static_cast<A>(z), static_cast<A>(w));
498 }
499
500 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, Vector4<T>>::type unit() const {
501 return *this / magnitude();
502 }
503 template <typename A = T> typename std::enable_if<std::is_floating_point<A>::value, float>::type dist(Vector4<T> o) const {
504 return (*this - o).magnitude();
505 }
506
507 Vector2<T> xy() const { return {x, y}; }
508 Vector2<T> xz() const { return {x, z}; }
509 Vector2<T> xw() const { return {x, w}; }
510 Vector2<T> yx() const { return {y, x}; }
511 Vector2<T> yz() const { return {y, z}; }
512 Vector2<T> yw() const { return {y, w}; }
513 Vector2<T> zx() const { return {z, x}; }
514 Vector2<T> zy() const { return {z, y}; }
515 Vector2<T> zw() const { return {z, w}; }
516 Vector2<T> wx() const { return {w, x}; }
517 Vector2<T> wy() const { return {w, y}; }
518 Vector2<T> wz() const { return {w, z}; }
519
520 Vector3<T> xyz() const { return {x, y, z}; }
521 Vector3<T> xyw() const { return {x, y, w}; }
522 Vector3<T> xzy() const { return {x, z, y}; }
523 Vector3<T> xzw() const { return {x, z, w}; }
524 Vector3<T> xwy() const { return {x, w, y}; }
525 Vector3<T> xwz() const { return {x, w, z}; }
526 Vector3<T> yxz() const { return {y, x, z}; }
527 Vector3<T> yxw() const { return {y, x, w}; }
528 Vector3<T> yzx() const { return {y, z, x}; }
529 Vector3<T> yzw() const { return {y, z, w}; }
530 Vector3<T> ywx() const { return {y, w, x}; }
531 Vector3<T> ywz() const { return {y, w, z}; }
532 Vector3<T> zxy() const { return {z, x, y}; }
533 Vector3<T> zxw() const { return {z, x, w}; }
534 Vector3<T> zyx() const { return {z, y, x}; }
535 Vector3<T> zyw() const { return {z, y, w}; }
536 Vector3<T> zwx() const { return {z, w, x}; }
537 Vector3<T> zwy() const { return {z, w, y}; }
538 Vector3<T> wxy() const { return {w, x, y}; }
539 Vector3<T> wxz() const { return {w, x, z}; }
540 Vector3<T> wyx() const { return {w, y, x}; }
541 Vector3<T> wyz() const { return {w, y, z}; }
542 Vector3<T> wzx() const { return {w, z, x}; }
543 Vector3<T> wzy() const { return {w, z, y}; }
544
545 Vector4<T> wzyx() const { return {w, z, y, x}; }
546 Vector4<T> zwyx() const { return {z, w, y, x}; }
547 Vector4<T> wyzx() const { return {w, y, z, x}; }
548 Vector4<T> ywzx() const { return {y, w, z, x}; }
549 Vector4<T> zywx() const { return {z, y, w, x}; }
550 Vector4<T> yzwx() const { return {y, z, w, x}; }
551 Vector4<T> wzxy() const { return {w, z, x, y}; }
552 Vector4<T> zwxy() const { return {z, w, x, y}; }
553 Vector4<T> wxzy() const { return {w, x, z, y}; }
554 Vector4<T> xwzy() const { return {x, w, z, y}; }
555 Vector4<T> zxwy() const { return {z, x, w, y}; }
556 Vector4<T> xzwy() const { return {x, z, w, y}; }
557 Vector4<T> wyxz() const { return {w, y, x, z}; }
558 Vector4<T> ywxz() const { return {y, w, x, z}; }
559 Vector4<T> wxyz() const { return {w, x, y, z}; }
560 Vector4<T> xwyz() const { return {x, w, y, z}; }
561 Vector4<T> yxwz() const { return {y, x, w, z}; }
562 Vector4<T> xywz() const { return {x, y, w, z}; }
563 Vector4<T> zyxw() const { return {z, y, x, w}; }
564 Vector4<T> yzxw() const { return {y, z, x, w}; }
565 Vector4<T> zxyw() const { return {z, x, y, w}; }
566 Vector4<T> xzyw() const { return {x, z, y, w}; }
567 Vector4<T> yxzw() const { return {y, x, z, w}; }
568 Vector4<T> xyzw() const { return {x, y, z, w}; }
569
570 static Vector4<T> zero() { return {0, 0, 0, 0}; }
571 static Vector4<T> one() { return {1, 1, 1, 1}; }
572 static Vector4<T> max() {
573 return {std::numeric_limits<T>::max(), std::numeric_limits<T>::max(), std::numeric_limits<T>::max(), std::numeric_limits<T>::max()};
574 }
575 static Vector4<T> min() {
576 return {std::numeric_limits<T>::min(), std::numeric_limits<T>::min(), std::numeric_limits<T>::min(), std::numeric_limits<T>::min()};
577 }
579 return {randomRange<T>(min, max), randomRange<T>(min, max), randomRange<T>(min, max), randomRange<T>(min, max)};
580 }
581 static Vector4<T> random(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW) {
582 return {randomRange<T>(minX, maxX), randomRange<T>(minY, maxY), randomRange<T>(minZ, maxZ), randomRange<T>(minW, maxW)};
583 }
584 };
585
600
615
630
632
636 template <typename T>
637 std::ostream& operator<<(std::ostream& os, const Kale::Vector2<T>& vec) {
638 os << "Vec2(" << vec.x << ", " << vec.y << ")";
639 return os;
640 }
641
645 template <typename T>
646 std::ostream& operator<<(std::ostream& os, const Kale::Vector3<T>& vec) {
647 os << "Vec3(" << vec.x << ", " << vec.y << ", " << vec.z << ")";
648 return os;
649 }
650
654 template <typename T>
655 std::ostream& operator<<(std::ostream& os, const Kale::Vector4<T>& vec) {
656 os << "Vec4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ")";
657 return os;
658 }
659
663 template <typename T>
664 void from_json(const JSON& j, Vector2<T>& p) {
665 p.x = j["x"].get<T>();
666 p.y = j["y"].get<T>();
667 }
668
672 template <typename T>
673 void to_json(JSON& j, const Vector2<T>& p) {
674 j = JSON{{"x", p.x}, {"y", p.y}};
675 }
676
680 template <typename T>
681 void from_json(const JSON& j, Vector3<T>& p) {
682 p.x = j["x"].get<T>();
683 p.y = j["y"].get<T>();
684 p.z = j["z"].get<T>();
685 }
686
690 template <typename T>
691 void to_json(JSON& j, const Vector3<T>& p) {
692 j = JSON{{"x", p.x}, {"y", p.y}, {"z", p.z}};
693 }
694
698 template <typename T>
699 void from_json(const JSON& j, Vector4<T>& p) {
700 if (j.contains("x")) {
701 p.x = j["x"].get<T>();
702 p.y = j["y"].get<T>();
703 p.z = j["z"].get<T>();
704 p.w = j["w"].get<T>();
705 }
706 else {
707 p.x = j["r"].get<T>();
708 p.y = j["g"].get<T>();
709 p.z = j["b"].get<T>();
710 p.w = j["a"].get<T>();
711 }
712 }
713
717 template <typename T>
718 void to_json(JSON& j, const Vector4<T>& p) {
719 j = JSON{{"x", p.x}, {"y", p.y}, {"z", p.z}, {"w", p.w}};
720 }
721
722}
Vector2< T > operator+(Vector2< T > o) const
Definition Vector.hpp:94
static Vector2< T > random(T min, T max)
Definition Vector.hpp:178
Vector2(T v[2])
Definition Vector.hpp:47
Vector2< T > clamp(Vector2< T > min, Vector2< T > max) const
Definition Vector.hpp:130
std::enable_if< std::is_floating_point< A >::value, float >::type dist(Vector2< T > o) const
Definition Vector.hpp:151
Vector2< T > operator*(Vector2< T > o) const
Definition Vector.hpp:96
static Vector2< T > max()
Definition Vector.hpp:175
void operator+=(Vector2< T > o)
Definition Vector.hpp:58
Vector2< A > cast() const
Definition Vector.hpp:144
Vector2< T > rotateCounterClockwise() const
Definition Vector.hpp:165
void clampTo(T minX, T maxX, T minY, T maxY)
Definition Vector.hpp:134
Vector2< T > xy() const
Definition Vector.hpp:168
Vector2< T > operator/(Vector2< T > o) const
Definition Vector.hpp:97
void operator=(T v[2])
Definition Vector.hpp:53
void operator/=(T v)
Definition Vector.hpp:87
Vector2< T > operator-() const
Definition Vector.hpp:92
bool operator<(Vector2< T > o) const
Definition Vector.hpp:110
float signedAngle(Vector2< T > to) const
Definition Vector.hpp:163
Vector2< T > normalized() const
Definition Vector.hpp:166
void clampTo(Vector2< T > min, Vector2< T > max)
Definition Vector.hpp:138
static Vector2< T > zero()
Definition Vector.hpp:172
Vector2< T > clamp(T minX, T maxX, T minY, T maxY) const
Definition Vector.hpp:127
void operator+=(T v)
Definition Vector.hpp:75
void operator*=(Vector2< T > o)
Definition Vector.hpp:66
Vector2< T > operator/(T v) const
Definition Vector.hpp:102
T dot(Vector2< T > o) const
Definition Vector.hpp:121
std::enable_if< std::is_integral< A >::value, bool >::type operator==(Vector2< T > o) const
Definition Vector.hpp:113
static Vector2< T > right()
Definition Vector.hpp:173
std::enable_if< std::is_floating_point< A >::value, T >::type magnitude() const
Definition Vector.hpp:123
void operator=(T n)
Definition Vector.hpp:49
bool operator!=(Vector2< T > o) const
Definition Vector.hpp:119
static Vector2< T > min()
Definition Vector.hpp:176
friend Vector2< T > operator-(float n, Vector2< T > v)
Definition Vector.hpp:105
std::enable_if< std::is_floating_point< A >::value, bool >::type operator==(Vector2< T > o) const
Definition Vector.hpp:116
Vector2< T > perpendicular(Vector2< T > o) const
Definition Vector.hpp:155
std::enable_if< std::is_floating_point< A >::value, Vector2< T > >::type unit() const
Definition Vector.hpp:148
Vector2< T > rotateClockwise() const
Definition Vector.hpp:164
Vector2< T > operator-(T v) const
Definition Vector.hpp:100
bool operator<=(Vector2< T > o) const
Definition Vector.hpp:111
friend Vector2< T > operator/(float n, Vector2< T > v)
Definition Vector.hpp:107
friend Vector2< T > operator*(float n, Vector2< T > v)
Definition Vector.hpp:106
static Vector2< T > random(T minX, T maxX, T minY, T maxY)
Definition Vector.hpp:179
static Vector2< T > up()
Definition Vector.hpp:174
friend Vector2< T > operator+(float n, Vector2< T > v)
Definition Vector.hpp:104
Vector2(T x, T y)
Definition Vector.hpp:46
Vector2< T > project(Vector2< T > o)
Definition Vector.hpp:158
Vector2< T > yx() const
Definition Vector.hpp:169
void operator-=(T v)
Definition Vector.hpp:79
Vector2< T > operator+(T v) const
Definition Vector.hpp:99
Vector2< T > operator*(T v) const
Definition Vector.hpp:101
void operator*=(T v)
Definition Vector.hpp:83
static Vector2< T > one()
Definition Vector.hpp:171
bool operator>=(Vector2< T > o) const
Definition Vector.hpp:112
void operator/=(Vector2< T > o)
Definition Vector.hpp:70
bool operator>(Vector2< T > o) const
Definition Vector.hpp:109
void operator-=(Vector2< T > o)
Definition Vector.hpp:62
T cross(Vector2< T > o) const
Definition Vector.hpp:122
Vector2< T > operator-(Vector2< T > o) const
Definition Vector.hpp:95
static Vector3< T > right()
Definition Vector.hpp:329
Vector3(T v[3])
Definition Vector.hpp:192
Vector3(T x, T y, T z)
Definition Vector.hpp:191
Vector2< T > xy() const
Definition Vector.hpp:313
Vector3< T > operator-(T v) const
Definition Vector.hpp:258
T dot(Vector3< T > o) const
Definition Vector.hpp:279
void operator=(T v[3])
Definition Vector.hpp:202
Vector3< T > operator+(T v) const
Definition Vector.hpp:257
std::enable_if< std::is_floating_point< A >::value, bool >::type operator==(Vector3< T > o) const
Definition Vector.hpp:274
Vector2< T > zx() const
Definition Vector.hpp:317
Vector2< T > yz() const
Definition Vector.hpp:316
static Vector3< T > max()
Definition Vector.hpp:332
void clampTo(T minX, T maxX, T minY, T maxY, T minZ, T maxZ)
Definition Vector.hpp:294
Vector3< T > yxz() const
Definition Vector.hpp:322
void operator-=(T v)
Definition Vector.hpp:234
Vector3< T > operator-(Vector3< T > o) const
Definition Vector.hpp:253
static Vector3< T > zero()
Definition Vector.hpp:327
void operator+=(T v)
Definition Vector.hpp:229
Vector3< T > xzy() const
Definition Vector.hpp:321
Vector3< T > operator/(T v) const
Definition Vector.hpp:260
Vector3< A > cast() const
Definition Vector.hpp:305
static Vector3< T > front()
Definition Vector.hpp:331
friend Vector3< T > operator-(float n, Vector3< T > v)
Definition Vector.hpp:263
Vector2< T > zy() const
Definition Vector.hpp:318
std::enable_if< std::is_integral< A >::value, bool >::type operator==(Vector3< T > o) const
Definition Vector.hpp:271
void operator/=(T v)
Definition Vector.hpp:244
Vector3< T > zyx() const
Definition Vector.hpp:325
Vector3< T > yzx() const
Definition Vector.hpp:323
bool operator>=(Vector3< T > o) const
Definition Vector.hpp:269
void operator+=(Vector3< T > o)
Definition Vector.hpp:208
void operator*=(T v)
Definition Vector.hpp:239
static Vector3< T > random(T min, T max)
Definition Vector.hpp:335
bool operator<(Vector3< T > o) const
Definition Vector.hpp:268
friend Vector3< T > operator+(float n, Vector3< T > v)
Definition Vector.hpp:262
Vector3< T > zxy() const
Definition Vector.hpp:324
static Vector3< T > up()
Definition Vector.hpp:330
void operator=(T n)
Definition Vector.hpp:197
Vector3< T > operator*(T v) const
Definition Vector.hpp:259
void operator*=(Vector3< T > o)
Definition Vector.hpp:218
void operator/=(Vector3< T > o)
Definition Vector.hpp:223
Vector3(T x, Vector2< T > v)
Definition Vector.hpp:195
Vector2< T > yx() const
Definition Vector.hpp:315
static Vector3< T > one()
Definition Vector.hpp:328
Vector2< T > xz() const
Definition Vector.hpp:314
Vector3< T > operator+(Vector3< T > o) const
Definition Vector.hpp:252
friend Vector3< T > operator/(float n, Vector3< T > v)
Definition Vector.hpp:265
Vector3< T > operator*(Vector3< T > o) const
Definition Vector.hpp:254
Vector3(Vector2< T > v, T z)
Definition Vector.hpp:194
Vector3< T > xyz() const
Definition Vector.hpp:320
Vector3< T > operator/(Vector3< T > o) const
Definition Vector.hpp:255
static Vector3< T > random(T minX, T maxX, T minY, T maxY, T minZ, T maxZ)
Definition Vector.hpp:336
void clampTo(Vector3< T > min, Vector3< T > max)
Definition Vector.hpp:299
bool operator>(Vector3< T > o) const
Definition Vector.hpp:267
std::enable_if< std::is_floating_point< A >::value, Vector3< T > >::type unit() const
Definition Vector.hpp:309
void operator-=(Vector3< T > o)
Definition Vector.hpp:213
static Vector3< T > min()
Definition Vector.hpp:333
std::enable_if< std::is_floating_point< A >::value, T >::type magnitude() const
Definition Vector.hpp:280
Vector3< T > clamp(T minX, T maxX, T minY, T maxY, T minZ, T maxZ) const
Definition Vector.hpp:287
Vector3< T > operator-() const
Definition Vector.hpp:250
std::enable_if< std::is_floating_point< A >::value, float >::type dist(Vector3< T > o) const
Definition Vector.hpp:283
bool operator!=(Vector3< T > o) const
Definition Vector.hpp:277
bool operator<=(Vector3< T > o) const
Definition Vector.hpp:270
friend Vector3< T > operator*(float n, Vector3< T > v)
Definition Vector.hpp:264
Vector3< T > clamp(Vector3< T > min, Vector3< T > max) const
Definition Vector.hpp:290
bool operator>(Vector4< T > o) const
Definition Vector.hpp:457
Vector4< T > operator-(Vector4< T > o) const
Definition Vector.hpp:443
void operator*=(Vector4< T > o)
Definition Vector.hpp:402
Vector4< T > zwxy() const
Definition Vector.hpp:552
Vector4< T > ywzx() const
Definition Vector.hpp:548
friend Vector4< T > operator-(float n, Vector4< T > v)
Definition Vector.hpp:453
Vector4< T > operator-() const
Definition Vector.hpp:440
Vector4(T x, T y, T z, T w)
Definition Vector.hpp:367
Vector4(float r, float g, float b)
Definition Vector.hpp:350
friend Vector4< T > operator+(float n, Vector4< T > v)
Definition Vector.hpp:452
Vector2< T > wx() const
Definition Vector.hpp:516
bool operator!=(Vector4< T > o) const
Definition Vector.hpp:467
Vector4< T > wyxz() const
Definition Vector.hpp:557
static Vector4< T > min()
Definition Vector.hpp:575
Vector4< T > wzyx() const
Definition Vector.hpp:545
Vector2< T > zx() const
Definition Vector.hpp:513
Vector2< T > zw() const
Definition Vector.hpp:515
Vector4< T > xwzy() const
Definition Vector.hpp:554
Vector3< T > zwy() const
Definition Vector.hpp:537
Vector3< T > zxw() const
Definition Vector.hpp:533
Vector3< T > xwy() const
Definition Vector.hpp:524
Vector4< T > yxzw() const
Definition Vector.hpp:567
Vector3< T > xyw() const
Definition Vector.hpp:521
void operator-=(Vector4< T > o)
Definition Vector.hpp:396
void operator*=(T v)
Definition Vector.hpp:427
Vector3< T > ywz() const
Definition Vector.hpp:531
std::enable_if< std::is_floating_point< A >::value, float >::type dist(Vector4< T > o) const
Definition Vector.hpp:503
Vector4< T > zxyw() const
Definition Vector.hpp:565
void operator+=(T v)
Definition Vector.hpp:415
bool operator<(Vector4< T > o) const
Definition Vector.hpp:458
Vector3< T > zyw() const
Definition Vector.hpp:535
Vector2< T > yx() const
Definition Vector.hpp:510
Vector2< T > xz() const
Definition Vector.hpp:508
friend Vector4< T > operator/(float n, Vector4< T > v)
Definition Vector.hpp:455
T dot(Vector4< T > o) const
Definition Vector.hpp:469
Vector3< T > wzx() const
Definition Vector.hpp:542
Vector4< T > clamp(Vector4< T > min, Vector4< T > max) const
Definition Vector.hpp:478
static Vector4< T > zero()
Definition Vector.hpp:570
Vector4< T > operator-(T v) const
Definition Vector.hpp:448
Vector3< T > xzw() const
Definition Vector.hpp:523
Vector4< T > zyxw() const
Definition Vector.hpp:563
Vector4< A > cast() const
Definition Vector.hpp:496
Vector4< T > xywz() const
Definition Vector.hpp:562
bool operator<=(Vector4< T > o) const
Definition Vector.hpp:460
void operator-=(T v)
Definition Vector.hpp:421
Vector4< T > yxwz() const
Definition Vector.hpp:561
Vector2< T > xy() const
Definition Vector.hpp:507
Vector4(T x, Vector2< T > v, T w)
Definition Vector.hpp:371
void clampTo(Vector4< T > min, Vector4< T > max)
Definition Vector.hpp:489
Vector4< T > xzwy() const
Definition Vector.hpp:556
Vector4< T > xyzw() const
Definition Vector.hpp:568
Vector4< T > yzxw() const
Definition Vector.hpp:564
std::enable_if< std::is_integral< A >::value, bool >::type operator==(Vector4< T > o) const
Definition Vector.hpp:461
void operator=(T v[4])
Definition Vector.hpp:383
Vector4< T > operator*(Vector4< T > o) const
Definition Vector.hpp:444
void operator+=(Vector4< T > o)
Definition Vector.hpp:390
bool operator>=(Vector4< T > o) const
Definition Vector.hpp:459
Vector2< T > wz() const
Definition Vector.hpp:518
Vector2< T > yz() const
Definition Vector.hpp:511
Vector4(Vector3< T > v, T w)
Definition Vector.hpp:374
Vector4< T > operator/(T v) const
Definition Vector.hpp:450
Vector4< T > zywx() const
Definition Vector.hpp:549
Vector2< T > xw() const
Definition Vector.hpp:509
Vector4< T > yzwx() const
Definition Vector.hpp:550
void operator/=(T v)
Definition Vector.hpp:433
std::enable_if< std::is_floating_point< A >::value, bool >::type operator==(Vector4< T > o) const
Definition Vector.hpp:464
static Vector4< T > random(T min, T max)
Definition Vector.hpp:578
Vector3< T > xwz() const
Definition Vector.hpp:525
Vector2< T > wy() const
Definition Vector.hpp:517
Vector2< T > yw() const
Definition Vector.hpp:512
Vector3< T > wyx() const
Definition Vector.hpp:540
Vector4< T > clamp(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW) const
Definition Vector.hpp:474
Vector4< T > operator+(Vector4< T > o) const
Definition Vector.hpp:442
Vector3< T > xyz() const
Definition Vector.hpp:520
Vector4< T > wxzy() const
Definition Vector.hpp:553
Vector4(T x, T y, Vector2< T > v)
Definition Vector.hpp:372
Vector3< T > yxz() const
Definition Vector.hpp:526
Vector3< T > wzy() const
Definition Vector.hpp:543
Vector3< T > xzy() const
Definition Vector.hpp:522
Vector4(T v[4])
Definition Vector.hpp:368
void operator=(T n)
Definition Vector.hpp:377
Vector4(Vector2< T > v, T z, T w)
Definition Vector.hpp:370
Vector4< T > zxwy() const
Definition Vector.hpp:555
Vector4< T > zwyx() const
Definition Vector.hpp:546
void operator/=(Vector4< T > o)
Definition Vector.hpp:408
Vector4(int hex)
Definition Vector.hpp:353
Vector2< T > zy() const
Definition Vector.hpp:514
Vector4< T > ywxz() const
Definition Vector.hpp:558
Vector4< T > xzyw() const
Definition Vector.hpp:566
static Vector4< T > max()
Definition Vector.hpp:572
Vector4< T > wzxy() const
Definition Vector.hpp:551
Vector3< T > yzx() const
Definition Vector.hpp:528
Vector3< T > zyx() const
Definition Vector.hpp:534
Vector3< T > ywx() const
Definition Vector.hpp:530
Vector4< T > operator*(T v) const
Definition Vector.hpp:449
Vector4< T > operator/(Vector4< T > o) const
Definition Vector.hpp:445
Vector3< T > wxy() const
Definition Vector.hpp:538
friend Vector4< T > operator*(float n, Vector4< T > v)
Definition Vector.hpp:454
Vector4< T > operator+(T v) const
Definition Vector.hpp:447
Vector3< T > yxw() const
Definition Vector.hpp:527
Vector4(int hex, float alpha)
Definition Vector.hpp:360
Vector3< T > wyz() const
Definition Vector.hpp:541
static Vector4< T > random(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW)
Definition Vector.hpp:581
void clampTo(T minX, T maxX, T minY, T maxY, T minZ, T maxZ, T minW, T maxW)
Definition Vector.hpp:483
std::enable_if< std::is_floating_point< A >::value, Vector4< T > >::type unit() const
Definition Vector.hpp:500
Vector4< T > xwyz() const
Definition Vector.hpp:560
Vector3< T > zxy() const
Definition Vector.hpp:532
std::enable_if< std::is_floating_point< A >::value, T >::type magnitude() const
Definition Vector.hpp:470
static Vector4< T > one()
Definition Vector.hpp:571
Vector4< T > wyzx() const
Definition Vector.hpp:547
Vector3< T > zwx() const
Definition Vector.hpp:536
Vector4< T > wxyz() const
Definition Vector.hpp:559
Vector3< T > wxz() const
Definition Vector.hpp:539
Vector3< T > yzw() const
Definition Vector.hpp:529
Vector4(T x, Vector3< T > v)
Definition Vector.hpp:375
Vector2< double > Vector2d
Definition Vector.hpp:599
Vector4< int > Vector4i
Definition Vector.hpp:618
Vector3< uint32_t > Vector3ui32
Definition Vector.hpp:612
Vector4< unsigned long > Vector4ul
Definition Vector.hpp:623
Vector4< unsigned long long > Vector4ull
Definition Vector.hpp:625
Vector2< char > Vector2c
Definition Vector.hpp:586
Vector2< unsigned short > Vector2us
Definition Vector.hpp:591
Vector4< long > Vector4l
Definition Vector.hpp:622
Vector3< long long > Vector3ll
Definition Vector.hpp:609
Vector2< long > Vector2l
Definition Vector.hpp:592
Vector4< unsigned int > Vector4ui
Definition Vector.hpp:619
Vector3< unsigned long > Vector3ul
Definition Vector.hpp:608
Vector2< long long > Vector2ll
Definition Vector.hpp:594
Vector3< short > Vector3s
Definition Vector.hpp:605
Vector2< unsigned long long > Vector2ull
Definition Vector.hpp:595
nlohmann::json JSON
Definition Scene.hpp:39
Vector4< float > Vector4f
Definition Vector.hpp:628
Vector3< size_t > Vector3st
Definition Vector.hpp:611
void to_json(JSON &j, const Matrix< w, h, T > &p)
Definition Matrix.hpp:547
bool isFloatingEqual(T num1, T num2, T epsilon=std::numeric_limits< T >::epsilon())
Definition Utils.hpp:69
Vector4< double > Vector4d
Definition Vector.hpp:629
Vector3< unsigned int > Vector3ui
Definition Vector.hpp:604
Vector2< unsigned int > Vector2ui
Definition Vector.hpp:589
Vector2< unsigned char > Vector2uc
Definition Vector.hpp:587
Vector2< size_t > Vector2st
Definition Vector.hpp:596
Vector2< int > Vector2i
Definition Vector.hpp:588
Vector3< float > Vector3f
Definition Vector.hpp:613
Vector2< short > Vector2s
Definition Vector.hpp:590
Vector4< uint32_t > Vector4ui32
Definition Vector.hpp:627
Vector2< uint32_t > Vector2ui32
Definition Vector.hpp:597
Vector4< long long > Vector4ll
Definition Vector.hpp:624
Vector3< double > Vector3d
Definition Vector.hpp:614
void from_json(const JSON &j, Matrix< w, h, T > &p)
Definition Matrix.hpp:539
Vector4f Color
Definition Vector.hpp:631
Vector3< long > Vector3l
Definition Vector.hpp:607
Vector3< unsigned short > Vector3us
Definition Vector.hpp:606
Vector4< char > Vector4c
Definition Vector.hpp:616
Vector2< unsigned long > Vector2ul
Definition Vector.hpp:593
Vector3< unsigned char > Vector3uc
Definition Vector.hpp:602
Vector4< unsigned short > Vector4us
Definition Vector.hpp:621
Vector3< char > Vector3c
Definition Vector.hpp:601
Vector4< size_t > Vector4st
Definition Vector.hpp:626
std::ostream & operator<<(std::ostream &os, const Kale::Matrix< w, h, T > &mat)
Definition Matrix.hpp:524
Vector3< unsigned long long > Vector3ull
Definition Vector.hpp:610
Vector4< unsigned char > Vector4uc
Definition Vector.hpp:617
Vector3< int > Vector3i
Definition Vector.hpp:603
Vector2< float > Vector2f
Definition Vector.hpp:598
Vector4< short > Vector4s
Definition Vector.hpp:620