1#pragma once
2
3#include <math/seadVectorCalcCommon.h>
4#ifndef SEAD_MATH_VECTOR_H_
5#include <math/seadVector.h>
6#endif
7
8namespace sead
9{
10template <typename T>
11inline Vector2<T>::Vector2(T x_, T y_)
12{
13 Vector2CalcCommon<T>::set(*this, x_, y_);
14}
15
16template <typename T>
17inline Vector2<T>& Vector2<T>::operator+=(const Vector2<T>& other)
18{
19 Vector2CalcCommon<T>::add(*this, *this, other);
20 return *this;
21}
22
23template <typename T>
24inline Vector2<T>& Vector2<T>::operator-=(const Vector2<T>& other)
25{
26 Vector2CalcCommon<T>::sub(*this, *this, other);
27 return *this;
28}
29
30template <typename T>
31inline Vector2<T>& Vector2<T>::operator*=(T t)
32{
33 this->x *= t;
34 this->y *= t;
35 return *this;
36}
37
38template <typename T>
39inline Vector2<T>& Vector2<T>::operator/=(T t)
40{
41 this->x /= t;
42 this->y /= t;
43 return *this;
44}
45
46template <typename T>
47inline Vector2<T>& Vector2<T>::operator=(const Vector2<T>& other)
48{
49 this->x = other.x;
50 this->y = other.y;
51 return *this;
52}
53
54template <typename T>
55inline void Vector2<T>::negate()
56{
57 Vector2CalcCommon<T>::negate(*this);
58}
59
60template <typename T>
61inline void Vector2<T>::multScalar(T t)
62{
63 Vector2CalcCommon<T>::multScalar(*this, *this, t);
64}
65
66template <typename T>
67inline void Vector2<T>::set(const Vector2<T>& other)
68{
69 Vector2CalcCommon<T>::set(*this, other);
70}
71
72template <typename T>
73inline void Vector2<T>::set(T x_, T y_)
74{
75 Vector2CalcCommon<T>::set(*this, x_, y_);
76}
77
78template <typename T>
79inline void Vector2<T>::setScale(const Vector2<T>& a, T t)
80{
81 Vector2CalcCommon<T>::multScalar(*this, a, t);
82}
83
84template <typename T>
85inline T Vector2<T>::dot(const Vector2<T>& t) const
86{
87 return Vector2CalcCommon<T>::dot(*this, t);
88}
89
90template <typename T>
91inline T Vector2<T>::cross(const Vector2<T>& t) const
92{
93 return Vector2CalcCommon<T>::cross(*this, t);
94}
95
96template <typename T>
97inline T Vector2<T>::length() const
98{
99 return Vector2CalcCommon<T>::length(*this);
100}
101
102template <typename T>
103inline T Vector2<T>::squaredLength() const
104{
105 return Vector2CalcCommon<T>::squaredLength(*this);
106}
107
108template <typename T>
109inline T Vector2<T>::normalize()
110{
111 return Vector2CalcCommon<T>::normalize(*this);
112}
113
114template <typename T>
115inline Vector3<T>::Vector3(T x_, T y_, T z_)
116{
117 Vector3CalcCommon<T>::set(*this, x_, y_, z_);
118}
119
120template <typename T>
121inline Vector3<T>& Vector3<T>::operator=(const Vector3<T>& other)
122{
123 this->x = other.x;
124 this->y = other.y;
125 this->z = other.z;
126 return *this;
127}
128
129template <typename T>
130inline bool Vector3<T>::operator==(const Vector3& rhs) const
131{
132 return this->x == rhs.x && this->y == rhs.y && this->z == rhs.z;
133}
134
135template <typename T>
136inline bool Vector3<T>::operator!=(const Vector3& rhs) const
137{
138 return !operator==(rhs);
139}
140
141template <typename T>
142inline Vector3<T>& Vector3<T>::operator+=(const Vector3<T>& other)
143{
144 Vector3CalcCommon<T>::add(*this, *this, other);
145 return *this;
146}
147
148template <typename T>
149inline Vector3<T>& Vector3<T>::operator-=(const Vector3<T>& other)
150{
151 Vector3CalcCommon<T>::sub(*this, *this, other);
152 return *this;
153}
154
155template <typename T>
156inline Vector3<T>& Vector3<T>::operator*=(T t)
157{
158 Vector3CalcCommon<T>::multScalar(*this, *this, t);
159 return *this;
160}
161
162template <typename T>
163inline Vector3<T>& Vector3<T>::operator*=(const Mtx33& m)
164{
165 mul(m);
166 return *this;
167}
168
169template <typename T>
170inline Vector3<T>& Vector3<T>::operator*=(const Mtx34& m)
171{
172 mul(m);
173 return *this;
174}
175
176template <typename T>
177inline Vector3<T>& Vector3<T>::operator/=(T t)
178{
179 this->x /= t;
180 this->y /= t;
181 this->z /= t;
182 return *this;
183}
184
185template <typename T>
186inline T Vector3<T>::dot(const Vector3<T>& t) const
187{
188 return Vector3CalcCommon<T>::dot(*this, t);
189}
190
191template <typename T>
192inline T Vector3<T>::length() const
193{
194 return Vector3CalcCommon<T>::length(*this);
195}
196
197template <typename T>
198inline T Vector3<T>::squaredLength() const
199{
200 return Vector3CalcCommon<T>::squaredLength(*this);
201}
202
203template <typename T>
204inline bool Vector3<T>::equals(const Vector3<T>& rhs, T epsilon) const
205{
206 return Vector3CalcCommon<T>::equals(*this, rhs, epsilon);
207}
208
209template <typename T>
210inline void Vector3<T>::add(const Vector3<T>& a)
211{
212 Vector3CalcCommon<T>::add(*this, *this, a);
213}
214
215template <typename T>
216inline void Vector3<T>::mul(const Mtx33& m)
217{
218 setMul(m, *this);
219}
220
221template <typename T>
222inline void Vector3<T>::mul(const Mtx34& m)
223{
224 setMul(m, *this);
225}
226
227template <typename T>
228inline void Vector3<T>::rotate(const Mtx33& m)
229{
230 setRotated(m, *this);
231}
232
233template <typename T>
234inline void Vector3<T>::rotate(const Mtx34& m)
235{
236 setRotated(m, *this);
237}
238
239template <typename T>
240inline void Vector3<T>::rotate(const Quat& q)
241{
242 setRotated(q, *this);
243}
244
245template <typename T>
246inline void Vector3<T>::multScalar(T t)
247{
248 Vector3CalcCommon<T>::multScalar(*this, *this, t);
249}
250
251template <typename T>
252inline T Vector3<T>::normalize()
253{
254 return Vector3CalcCommon<T>::normalize(*this);
255}
256
257template <typename T>
258inline void Vector3<T>::negate()
259{
260 Vector3CalcCommon<T>::negate(*this);
261}
262
263template <typename T>
264inline void Vector3<T>::set(const Vector3<T>& other)
265{
266 Vector3CalcCommon<T>::set(*this, other);
267}
268
269template <typename T>
270inline void Vector3<T>::set(T x_, T y_, T z_)
271{
272 Vector3CalcCommon<T>::set(*this, x_, y_, z_);
273}
274
275template <typename T>
276inline void Vector3<T>::setAdd(const Vector3<T>& a, const Vector3<T>& b)
277{
278 Vector3CalcCommon<T>::add(*this, a, b);
279}
280
281template <typename T>
282inline void Vector3<T>::setCross(const Vector3<T>& a, const Vector3<T>& b)
283{
284 Vector3CalcCommon<T>::cross(*this, a, b);
285}
286
287template <typename T>
288inline void Vector3<T>::setScale(const Vector3<T>& a, T t)
289{
290 Vector3CalcCommon<T>::multScalar(*this, a, t);
291}
292
293template <typename T>
294inline void Vector3<T>::setScaleAdd(T t, const Vector3<T>& a, const Vector3<T>& b)
295{
296 Vector3CalcCommon<T>::multScalarAdd(*this, t, a, b);
297}
298
299template <typename T>
300inline void Vector3<T>::setMul(const Mtx33& m, const Vector3<T>& a)
301{
302 Vector3CalcCommon<T>::mul(*this, m, a);
303}
304
305template <typename T>
306inline void Vector3<T>::setMul(const Mtx34& m, const Vector3<T>& a)
307{
308 Vector3CalcCommon<T>::mul(*this, m, a);
309}
310
311template <typename T>
312inline void Vector3<T>::setRotated(const Mtx33& m, const Vector3<T>& a)
313{
314 Vector3CalcCommon<T>::rotate(*this, m, a);
315}
316
317template <typename T>
318inline void Vector3<T>::setRotated(const Mtx34& m, const Vector3<T>& a)
319{
320 Vector3CalcCommon<T>::rotate(*this, m, a);
321}
322
323template <typename T>
324inline void Vector3<T>::setRotated(const Quat& q, const Vector3<T>& a)
325{
326 Vector3CalcCommon<T>::rotate(*this, q, a);
327}
328
329template <typename T>
330inline void Vector3<T>::setSub(const Vector3<T>& a, const Vector3<T>& b)
331{
332 Vector3CalcCommon<T>::sub(*this, a, b);
333}
334
335template <typename T>
336inline Vector4<T>::Vector4(T x_, T y_, T z_, T w_)
337{
338 Vector4CalcCommon<T>::set(*this, x_, y_, z_, w_);
339}
340
341template <typename T>
342inline Vector4<T>& Vector4<T>::operator+=(const Vector4<T>& other)
343{
344 this->x += other.x;
345 this->y += other.y;
346 this->z += other.z;
347 this->w += other.w;
348 return *this;
349}
350
351template <typename T>
352inline Vector4<T>& Vector4<T>::operator-=(const Vector4<T>& other)
353{
354 this->x -= other.x;
355 this->y -= other.y;
356 this->z -= other.z;
357 this->w -= other.w;
358 return *this;
359}
360
361template <typename T>
362inline Vector4<T>& Vector4<T>::operator*=(T t)
363{
364 this->x *= t;
365 this->y *= t;
366 this->z *= t;
367 this->w *= t;
368 return *this;
369}
370
371template <typename T>
372inline Vector4<T>& Vector4<T>::operator/=(T t)
373{
374 this->x /= t;
375 this->y /= t;
376 this->z /= t;
377 this->w /= t;
378 return *this;
379}
380
381template <typename T>
382inline Vector4<T>& Vector4<T>::operator=(const Vector4<T>& other)
383{
384 this->x = other.x;
385 this->y = other.y;
386 this->z = other.z;
387 this->w = other.w;
388 return *this;
389}
390
391template <typename T>
392inline T Vector4<T>::normalize()
393{
394 return Vector4CalcCommon<T>::normalize(*this);
395}
396
397template <typename T>
398inline void Vector4<T>::negate()
399{
400 Vector4CalcCommon<T>::negate(*this);
401}
402
403template <typename T>
404inline T Vector4<T>::length() const
405{
406 return Vector4CalcCommon<T>::length(*this);
407}
408
409template <typename T>
410inline T Vector4<T>::squaredLength() const
411{
412 return Vector4CalcCommon<T>::squaredLength(*this);
413}
414
415template <typename T>
416inline void Vector4<T>::set(const Vector4<T>& other)
417{
418 Vector4CalcCommon<T>::set(*this, other);
419}
420
421template <typename T>
422inline void Vector4<T>::set(T x_, T y_, T z_, T w_)
423{
424 Vector4CalcCommon<T>::set(*this, x_, y_, z_, w_);
425}
426
427} // namespace sead
428