summaryrefslogtreecommitdiffstats
path: root/src/core/Vector3.cpp
diff options
context:
space:
mode:
authorMarc <marc.gilleron@gmail.com>2021-01-31 19:32:56 +0000
committerGitHub <noreply@github.com>2021-01-31 19:32:56 +0000
commit1aab5e3962e311caebae04f44fff9c4e1cd7d9c0 (patch)
treec55e3435691883c62bed6375c6b236a9715c85c7 /src/core/Vector3.cpp
parent2559c70e274f9239cd29c434ab262c46f6dc8552 (diff)
parent35f78dea5196d4d676946a84c10206a5cb1a1fa0 (diff)
downloadredot-cpp-1aab5e3962e311caebae04f44fff9c4e1cd7d9c0.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'src/core/Vector3.cpp')
-rw-r--r--src/core/Vector3.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/core/Vector3.cpp b/src/core/Vector3.cpp
index cf95792..879de0b 100644
--- a/src/core/Vector3.cpp
+++ b/src/core/Vector3.cpp
@@ -67,17 +67,12 @@ void Vector3::rotate(const Vector3 &p_axis, real_t p_phi) {
*this = Basis(p_axis, p_phi).xform(*this);
}
-// this is ugly as well, but hey, I'm a simple man
-#define _ugly_stepify(val, step) (step != 0 ? ::floor(val / step + 0.5) * step : val)
-
void Vector3::snap(real_t p_val) {
- x = _ugly_stepify(x, p_val);
- y = _ugly_stepify(y, p_val);
- z = _ugly_stepify(z, p_val);
+ x = Math::stepify(x, p_val);
+ y = Math::stepify(y, p_val);
+ z = Math::stepify(z, p_val);
}
-#undef _ugly_stepify
-
Vector3::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z);
}