diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-07 20:36:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 20:36:20 +0200 |
commit | 31600f07d2fae10a2f256ea5621e0a64d8bb671b (patch) | |
tree | 3bdefcacfa7925d4ca0ca7ed8bdc94978b8db123 /core/math/vector3.cpp | |
parent | 667e464e64c98692b3ea1412a143c624d754dbb7 (diff) | |
parent | 40197685bb0dbc76b7670fdd9fdddf07b44659ff (diff) |
Merge pull request #32623 from madmiraal/remove-circular-includes
Remove circular dependency between Vector3 and Basis.
Diffstat (limited to 'core/math/vector3.cpp')
-rw-r--r-- | core/math/vector3.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 73927821cf..ebc1599820 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -134,6 +134,21 @@ Vector3 Vector3::move_toward(const Vector3 &p_to, const real_t p_delta) const { return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta; } +Basis Vector3::outer(const Vector3 &p_b) const { + + Vector3 row0(x * p_b.x, x * p_b.y, x * p_b.z); + Vector3 row1(y * p_b.x, y * p_b.y, y * p_b.z); + Vector3 row2(z * p_b.x, z * p_b.y, z * p_b.z); + + return Basis(row0, row1, row2); +} + +Basis Vector3::to_diagonal_matrix() const { + return Basis(x, 0, 0, + 0, y, 0, + 0, 0, z); +} + Vector3::operator String() const { return (rtos(x) + ", " + rtos(y) + ", " + rtos(z)); |