diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2023-12-20 10:42:39 -0600 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2023-12-20 18:24:03 -0600 |
commit | c77ae051d56a55abfba5f65f872da953feb1d216 (patch) | |
tree | b05819bf2e078474717734434dd1f90172515d16 /core/math/basis.h | |
parent | c28a091a09c39ed45931cd7830ae418d369fd9e6 (diff) | |
download | redot-engine-c77ae051d56a55abfba5f65f872da953feb1d216.tar.gz |
Add and expose Basis/Transform2D/3D division by float operator
Diffstat (limited to 'core/math/basis.h')
-rw-r--r-- | core/math/basis.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/math/basis.h b/core/math/basis.h index b4d971464e..e3094114e8 100644 --- a/core/math/basis.h +++ b/core/math/basis.h @@ -136,6 +136,8 @@ struct _NO_DISCARD_ Basis { _FORCE_INLINE_ Basis operator-(const Basis &p_matrix) const; _FORCE_INLINE_ void operator*=(const real_t p_val); _FORCE_INLINE_ Basis operator*(const real_t p_val) const; + _FORCE_INLINE_ void operator/=(const real_t p_val); + _FORCE_INLINE_ Basis operator/(const real_t p_val) const; bool is_orthogonal() const; bool is_orthonormal() const; @@ -289,6 +291,18 @@ _FORCE_INLINE_ Basis Basis::operator*(const real_t p_val) const { return ret; } +_FORCE_INLINE_ void Basis::operator/=(const real_t p_val) { + rows[0] /= p_val; + rows[1] /= p_val; + rows[2] /= p_val; +} + +_FORCE_INLINE_ Basis Basis::operator/(const real_t p_val) const { + Basis ret(*this); + ret /= p_val; + return ret; +} + Vector3 Basis::xform(const Vector3 &p_vector) const { return Vector3( rows[0].dot(p_vector), |