sead
Loading...
Searching...
No Matches
seadVector.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <math/seadVectorCalcCommon.h>
4
5namespace sead {
6
7template <typename T>
8inline constexpr
10{
11 Vector2CalcCommon<T>::set(*this, x_, y_);
12}
13
14template <typename T>
15template <typename VectorType>
16inline constexpr
18{
19 Vector2CalcCommon<T>::set(*this, static_cast<T>(v.x), static_cast<T>(v.y));
20}
21
22template <typename T>
23inline Vector2<T>
24Vector2<T>::operator*(T t) const
25{
26 Self o;
27 Vector2CalcCommon<T>::multScalar(o, *this, t);
28 return o;
29}
30
31template <typename T>
32inline Vector2<T>
33operator*(T t, const Vector2<T>& v)
34{
35 Vector2<T> o;
36 Vector2CalcCommon<T>::multScalar(o, v, t);
37 return o;
38}
39
40template <typename T>
41inline Vector2<T>
42Vector2<T>::operator/(T t) const
43{
44 Self o;
45 Vector2CalcCommon<T>::divScalar(o, *this, t);
46 return o;
47}
48
49template <typename T>
50inline Vector2<T>
51Vector2<T>::operator+(const Self& v) const
52{
53
54 Self o;
55 Vector2CalcCommon<T>::add(o, *this, v);
56 return o;
57}
58
59template <typename T>
60inline Vector2<T>
61Vector2<T>::operator-(const Self& v) const
62{
63
64 Self o;
65 Vector2CalcCommon<T>::sub(o, *this, v);
66 return o;
67}
68
69template <typename T>
70inline Vector2<T>
71Vector2<T>::operator-() const
72{
73 Self o;
74 Vector2CalcCommon<T>::neg(o, *this);
75 return o;
76}
77
78template <typename T>
79inline Vector2<T>&
81{
82 Vector2CalcCommon<T>::multScalar(*this, *this, t);
83 return *this;
84}
85
86template <typename T>
87inline Vector2<T>&
89{
90 Vector2CalcCommon<T>::divScalar(*this, *this, t);
91 return *this;
92}
93
94template <typename T>
95inline Vector2<T>&
96Vector2<T>::operator+=(const Self& v)
97{
98 Vector2CalcCommon<T>::add(*this, *this, v);
99 return *this;
100}
101
102template <typename T>
103inline Vector2<T>&
105{
106 Vector2CalcCommon<T>::sub(*this, *this, v);
107 return *this;
108}
109
110template <typename T>
111inline Vector2<T>&
113{
114 this->x = v.x;
115 this->y = v.y;
116 return *this;
117}
118
119template <typename T>
120template <typename VectorType>
121inline Vector2<T>&
123{
124 this->x = static_cast<T>(v.x);
125 this->y = static_cast<T>(v.y);
126 return *this;
127}
128
129template <typename T>
130inline bool
131Vector2<T>::operator==(const Self& v) const
132{
133 return Vector2CalcCommon<T>::isEqual(*this, v);
134}
135
136template <typename T>
137inline bool
138Vector2<T>::operator!=(const Self& v) const
139{
140 return !Vector2CalcCommon<T>::isEqual(*this, v);
141}
142
143template <typename T>
144inline T
145Vector2<T>::dot(const Self& t) const
146{
147 return Vector2CalcCommon<T>::dot(*this, t);
148}
149
150template <typename T>
151inline T
153{
154 return Vector2CalcCommon<T>::squaredLength(*this);
155}
156
157template <typename T>
158inline T
159Vector2<T>::length() const
160{
161 return Vector2CalcCommon<T>::length(*this);
162}
163
164template <typename T>
165inline T
167{
168 return Vector2CalcCommon<T>::squaredDistance(*this, v);
169}
170
171template <typename T>
172inline T
173Vector2<T>::distance(const Self& v) const
174{
175 return Vector2CalcCommon<T>::distance(*this, v);
176}
177
178template <typename T>
179inline void
180Vector2<T>::add(const Self& a)
181{
182 Vector2CalcCommon<T>::add(*this, *this, a);
183}
184
185template <typename T>
186inline void
187Vector2<T>::div(const Self& a)
188{
189 Vector2CalcCommon<T>::div(*this, *this, a);
190}
191
192template <typename T>
193inline void
195{
196 Vector2CalcCommon<T>::multScalar(*this, *this, t);
197}
198
199template <typename T>
200inline T
202{
203 return Vector2CalcCommon<T>::normalize(*this);
204}
205
206template <typename T>
207inline T
209{
210 return Vector2CalcCommon<T>::setNormalize(*this, v);
211}
212
213template <typename T>
214inline void
215Vector2<T>::set(const Self& v)
216{
217 Vector2CalcCommon<T>::set(*this, v);
218}
219
220template <typename T>
221inline void
223{
224 Vector2CalcCommon<T>::set(*this, x_, y_);
225}
226
227template <typename T>
228inline void
229Vector2<T>::setSub(const Self& a, const Self& b)
230{
231 Vector2CalcCommon<T>::sub(*this, a, b);
232}
233
234template <typename T>
235inline void
236Vector2<T>::setLerp(const Self& a, const Self& b, f32 ratio)
237{
238 Vector2CalcCommon<T>::lerp(*this, a, b, ratio);
239}
240
241template <typename T>
242inline constexpr
244{
245 Vector3CalcCommon<T>::set(*this, x_, y_, z_);
246}
247
248template <typename T>
249inline constexpr
251{
252 Vector3CalcCommon<T>::set(*this, vec2.x, vec2.y, z_);
253}
254
255template <typename T>
256inline Vector3<T>
258{
259 Self o;
260 Vector3CalcCommon<T>::multScalar(o, *this, t);
261 return o;
262}
263
264template <typename T>
265inline Vector3<T>
266operator*(T t, const Vector3<T>& v)
267{
268 Vector3<T> o;
269 Vector3CalcCommon<T>::multScalar(o, v, t);
270 return o;
271}
272
273template <typename T>
274inline Vector3<T>
276{
277 Self o;
278 Vector3CalcCommon<T>::divScalar(o, *this, t);
279 return o;
280}
281
282template <typename T>
283inline Vector3<T>
284Vector3<T>::operator+(const Self& v) const
285{
286
287 Self o;
288 Vector3CalcCommon<T>::add(o, *this, v);
289 return o;
290}
291
292template <typename T>
293inline Vector3<T>
294Vector3<T>::operator-(const Self& v) const
295{
296
297 Self o;
298 Vector3CalcCommon<T>::sub(o, *this, v);
299 return o;
300}
301
302template <typename T>
303inline Vector3<T>
305{
306 Self o;
307 Vector3CalcCommon<T>::neg(o, *this);
308 return o;
309}
310
311template <typename T>
312inline Vector3<T>&
314{
315 Vector3CalcCommon<T>::multScalar(*this, *this, t);
316 return *this;
317}
318
319template <typename T>
320inline Vector3<T>&
322{
323 Vector3CalcCommon<T>::divScalar(*this, *this, t);
324 return *this;
325}
326
327template <typename T>
328inline Vector3<T>&
330{
331 Vector3CalcCommon<T>::add(*this, *this, v);
332 return *this;
333}
334
335template <typename T>
336inline Vector3<T>&
338{
339 Vector3CalcCommon<T>::sub(*this, *this, v);
340 return *this;
341}
342
343template <typename T>
344inline Vector3<T>&
346{
347 this->x = v.x;
348 this->y = v.y;
349 this->z = v.z;
350 return *this;
351}
352
353template <typename T>
354inline bool
355Vector3<T>::operator==(const Self& v) const
356{
357 return Vector3CalcCommon<T>::isEqual(*this, v);
358}
359
360template <typename T>
361inline bool
362Vector3<T>::operator!=(const Self& v) const
363{
364 return !Vector3CalcCommon<T>::isEqual(*this, v);
365}
366
367template <typename T>
368inline T
369Vector3<T>::dot(const Self& t) const
370{
371 return Vector3CalcCommon<T>::dot(*this, t);
372}
373
374template <typename T>
375inline T
377{
378 return Vector3CalcCommon<T>::squaredLength(*this);
379}
380
381template <typename T>
382inline T
383Vector3<T>::length() const
384{
385 return Vector3CalcCommon<T>::length(*this);
386}
387
388template <typename T>
389inline T
391{
392 return Vector3CalcCommon<T>::squaredDistance(*this, v);
393}
394
395template <typename T>
396inline T
397Vector3<T>::distance(const Self& v) const
398{
399 return Vector3CalcCommon<T>::distance(*this, v);
400}
401
402template <typename T>
403inline void
404Vector3<T>::add(const Self& a)
405{
406 Vector3CalcCommon<T>::add(*this, *this, a);
407}
408
409template <typename T>
410inline void
412{
413 Vector3CalcCommon<T>::multScalar(*this, *this, t);
414}
415
416template <typename T>
417inline T
419{
420 return Vector3CalcCommon<T>::normalize(*this);
421}
422
423template <typename T>
424inline T
426{
427 return Vector3CalcCommon<T>::setNormalize(*this, v);
428}
429
430template <typename T>
431inline void
432Vector3<T>::set(const Self& v)
433{
434 Vector3CalcCommon<T>::set(*this, v);
435}
436
437template <typename T>
438inline void
440{
441 Vector3CalcCommon<T>::set(*this, x_, y_, z_);
442}
443
444template <typename T>
445inline void
447{
448 Vector3CalcCommon<T>::set(*this, vec2.x, vec2.y, z_);
449}
450
451template <typename T>
452inline void
453Vector3<T>::setAdd(const Self& a, const Self& b)
454{
455 Vector3CalcCommon<T>::add(*this, a, b);
456}
457
458template <typename T>
459inline void
460Vector3<T>::setSub(const Self& a, const Self& b)
461{
462 Vector3CalcCommon<T>::sub(*this, a, b);
463}
464
465template <typename T>
466inline void
467Vector3<T>::setCross(const Self& a, const Self& b)
468{
469 Vector3CalcCommon<T>::cross(*this, a, b);
470}
471
472template <typename T>
473inline void
474Vector3<T>::setLerp(const Self& a, const Self& b, f32 ratio)
475{
476 Vector3CalcCommon<T>::lerp(*this, a, b, ratio);
477}
478
479template <typename T>
480inline void
481Vector3<T>::setMul(const Mtx34& m, const Self& v)
482{
483 Vector3CalcCommon<T>::mul(*this, m, v);
484}
485
486template <typename T>
487inline void
488Vector3<T>::setRotate(const Mtx33& m, const Self& v)
489{
490 Vector3CalcCommon<T>::rotate(*this, m, v);
491}
492
493template <typename T>
494inline void
495Vector3<T>::setRotate(const Mtx34& m, const Self& v)
496{
497 Vector3CalcCommon<T>::rotate(*this, m, v);
498}
499
500template <typename T>
501inline void
502Vector3<T>::setScaleAdd(T t, const Self& a, const Self& b)
503{
504 Vector3CalcCommon<T>::multScalarAdd(*this, t, a, b);
505}
506
507template <typename T>
508inline constexpr
510{
511 Vector4CalcCommon<T>::set(*this, x_, y_, z_, w_);
512}
513
514template <typename T>
515inline constexpr
517{
518 Vector4CalcCommon<T>::set(*this, vec2.x, vec2.y, z_, w_);
519}
520
521template <typename T>
522inline constexpr
524{
525 Vector4CalcCommon<T>::set(*this, vec3.x, vec3.y, vec3.z, w_);
526}
527
528template <typename T>
529inline Vector4<T>
531{
532 Self o;
533 Vector4CalcCommon<T>::multScalar(o, *this, t);
534 return o;
535}
536
537template <typename T>
538inline Vector4<T>
539operator*(T t, const Vector4<T>& v)
540{
541 Vector4<T> o;
542 Vector4CalcCommon<T>::multScalar(o, v, t);
543 return o;
544}
545
546template <typename T>
547inline Vector4<T>
549{
550 Self o;
551 Vector4CalcCommon<T>::divScalar(o, *this, t);
552 return o;
553}
554
555template <typename T>
556inline Vector4<T>
557Vector4<T>::operator+(const Self& v) const
558{
559
560 Self o;
561 Vector4CalcCommon<T>::add(o, *this, v);
562 return o;
563}
564
565template <typename T>
566inline Vector4<T>
567Vector4<T>::operator-(const Self& v) const
568{
569
570 Self o;
571 Vector4CalcCommon<T>::sub(o, *this, v);
572 return o;
573}
574
575template <typename T>
576inline Vector4<T>
578{
579 Self o;
580 Vector4CalcCommon<T>::neg(o, *this);
581 return o;
582}
583
584template <typename T>
585inline Vector4<T>&
587{
588 Vector4CalcCommon<T>::multScalar(*this, *this, t);
589 return *this;
590}
591
592template <typename T>
593inline Vector4<T>&
595{
596 Vector4CalcCommon<T>::divScalar(*this, *this, t);
597 return *this;
598}
599
600template <typename T>
601inline Vector4<T>&
603{
604 Vector4CalcCommon<T>::add(*this, *this, v);
605 return *this;
606}
607
608template <typename T>
609inline Vector4<T>&
611{
612 Vector4CalcCommon<T>::sub(*this, *this, v);
613 return *this;
614}
615
616template <typename T>
617inline Vector4<T>&
619{
620 this->x = v.x;
621 this->y = v.y;
622 this->z = v.z;
623 this->w = v.w;
624 return *this;
625}
626
627template <typename T>
628inline bool
629Vector4<T>::operator==(const Self& v) const
630{
631 return Vector4CalcCommon<T>::isEqual(*this, v);
632}
633
634template <typename T>
635inline bool
636Vector4<T>::operator!=(const Self& v) const
637{
638 return !Vector4CalcCommon<T>::isEqual(*this, v);
639}
640
641template <typename T>
642inline T
643Vector4<T>::dot(const Self& t) const
644{
645 return Vector4CalcCommon<T>::dot(*this, t);
646}
647
648template <typename T>
649inline T
651{
652 return Vector4CalcCommon<T>::squaredLength(*this);
653}
654
655template <typename T>
656inline T
657Vector4<T>::length() const
658{
659 return Vector4CalcCommon<T>::length(*this);
660}
661
662template <typename T>
663inline T
665{
666 return Vector4CalcCommon<T>::squaredDistance(*this, v);
667}
668
669template <typename T>
670inline T
671Vector4<T>::distance(const Self& v) const
672{
673 return Vector4CalcCommon<T>::distance(*this, v);
674}
675
676template <typename T>
677inline void
679{
680 Vector4CalcCommon<T>::multScalar(*this, *this, t);
681}
682
683template <typename T>
684inline T
686{
687 return Vector4CalcCommon<T>::normalize(*this);
688}
689
690template <typename T>
691inline T
693{
694 return Vector4CalcCommon<T>::setNormalize(*this, v);
695}
696
697template <typename T>
698inline void
699Vector4<T>::set(const Self& v)
700{
701 Vector4CalcCommon<T>::set(*this, v);
702}
703
704template <typename T>
705inline void
707{
708 Vector4CalcCommon<T>::set(*this, x_, y_, z_, w_);
709}
710
711template <typename T>
712inline void
713Vector4<T>::set(const Vec2& vec2, T z_, T w_)
714{
715 Vector4CalcCommon<T>::set(*this, vec2.x, vec2.y, z_, w_);
716}
717
718template <typename T>
719inline void
721{
722 Vector4CalcCommon<T>::set(*this, vec3.x, vec3.y, vec3.z, w_);
723}
724
725template <typename T>
726inline void
727Vector4<T>::setLerp(const Self& a, const Self& b, f32 ratio)
728{
729 Vector4CalcCommon<T>::lerp(*this, a, b, ratio);
730}
731
732} // namespace sead
Definition seadVectorCalcCommon.h:11
Definition seadVectorCalcCommon.h:44
Definition seadVectorCalcCommon.h:83
Definition seadAssert.h:44