summaryrefslogtreecommitdiffstats
path: root/core/math/basis.cpp
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-02-25 09:54:50 -0500
committerAaron Franke <arnfranke@yahoo.com>2021-06-11 10:53:20 -0400
commit554c776e08c9ee35fa9e2677e02f4005c11ddbc0 (patch)
tree1ea2b367e5cd59a8c9b049ceaeb0d6f4253f9aed /core/math/basis.cpp
parent6b0183ec893ddea3f8ae71005b5fce1ae988e8a0 (diff)
downloadredot-engine-554c776e08c9ee35fa9e2677e02f4005c11ddbc0.tar.gz
Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant). For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
Diffstat (limited to 'core/math/basis.cpp')
-rw-r--r--core/math/basis.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 7489da34d9..aa3831d4cf 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -756,18 +756,9 @@ bool Basis::operator!=(const Basis &p_matrix) const {
}
Basis::operator String() const {
- String mtx;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- if (i != 0 || j != 0) {
- mtx += ", ";
- }
-
- mtx += rtos(elements[j][i]); //matrix is stored transposed for performance, so print it transposed
- }
- }
-
- return mtx;
+ return "[X: " + get_axis(0).operator String() +
+ ", Y: " + get_axis(1).operator String() +
+ ", Z: " + get_axis(2).operator String() + "]";
}
Quaternion Basis::get_quaternion() const {