| 1 | #pragma once |
| 2 | |
| 3 | #include <math/seadMathPolicies.h> |
| 4 | |
| 5 | namespace sead |
| 6 | { |
| 7 | template <typename T> |
| 8 | class Vector2CalcCommon |
| 9 | { |
| 10 | public: |
| 11 | using Base = typename Policies<T>::Vec2Base; |
| 12 | |
| 13 | public: |
| 14 | static void add(Base& o, const Base& a, const Base& b); |
| 15 | static void sub(Base& o, const Base& a, const Base& b); |
| 16 | static void multScalar(Base& o, const Base& v, T t); |
| 17 | |
| 18 | static void negate(Base& v); |
| 19 | static void set(Base& o, const Base& v); |
| 20 | static void set(Base& v, T x, T y); |
| 21 | |
| 22 | static T dot(const Base& a, const Base& b); |
| 23 | static T cross(const Base& a, const Base& b); |
| 24 | static T squaredLength(const Base& v); |
| 25 | static T length(const Base& v); |
| 26 | static T normalize(Base& v); |
| 27 | }; |
| 28 | |
| 29 | template <typename T> |
| 30 | class Vector3CalcCommon |
| 31 | { |
| 32 | public: |
| 33 | using Base = typename Policies<T>::Vec3Base; |
| 34 | using Mtx33 = typename Policies<T>::Mtx33Base; |
| 35 | using Mtx34 = typename Policies<T>::Mtx34Base; |
| 36 | using Quat = typename Policies<T>::QuatBase; |
| 37 | |
| 38 | static void add(Base& o, const Base& a, const Base& b); |
| 39 | static void sub(Base& o, const Base& a, const Base& b); |
| 40 | /// Apply a rotation `m` to the vector `a`. |
| 41 | static void mul(Base& o, const Mtx33& m, const Base& a); |
| 42 | /// Apply a transformation `m` (rotation then translation) to the vector `a`. |
| 43 | static void mul(Base& o, const Mtx34& m, const Base& a); |
| 44 | |
| 45 | /// Apply a rotation `m` to the vector `a`. |
| 46 | static void rotate(Base& o, const Mtx33& m, const Base& a); |
| 47 | /// Apply a rotation `m` to the vector `a`. |
| 48 | static void rotate(Base& o, const Mtx34& m, const Base& a); |
| 49 | /// Apply a rotation 'q' to the vector 'a' |
| 50 | static void rotate(Base& o, const Quat& q, const Base& a); |
| 51 | |
| 52 | static void cross(Base& o, const Base& a, const Base& b); |
| 53 | static T dot(const Base& a, const Base& b); |
| 54 | static T squaredLength(const Base& v); |
| 55 | static T length(const Base& v); |
| 56 | static bool equals(const Base& lhs, const Base& rhs, T epsilon); |
| 57 | static void multScalar(Base& o, const Base& v, T t); |
| 58 | static void multScalarAdd(Base& o, T t, const Base& a, const Base& b); |
| 59 | static T normalize(Base& v); |
| 60 | static void negate(Base& v); |
| 61 | static void set(Base& o, const Base& v); |
| 62 | static void set(Base& v, T x, T y, T z); |
| 63 | }; |
| 64 | |
| 65 | template <typename T> |
| 66 | class Vector4CalcCommon |
| 67 | { |
| 68 | public: |
| 69 | using Base = typename Policies<T>::Vec4Base; |
| 70 | |
| 71 | public: |
| 72 | static T normalize(Base& v); |
| 73 | static void negate(Base& v); |
| 74 | static T squaredLength(const Base& v); |
| 75 | static T length(const Base& v); |
| 76 | static void set(Base& o, const Base& v); |
| 77 | static void set(Base& v, T x, T y, T z, T w); |
| 78 | }; |
| 79 | |
| 80 | } // namespace sead |
| 81 | |
| 82 | #define SEAD_MATH_VECTOR_CALC_COMMON_H_ |
| 83 | #include <math/seadVectorCalcCommon.hpp> |
| 84 | #undef SEAD_MATH_VECTOR_CALC_COMMON_H_ |
| 85 | |