1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Convert spaces to tabs (#13506)

* Convert spaces to tabs

* Desour reviews 1-3 fix

* Desour fixes

* Undo alignment changes
This commit is contained in:
Thresher 2023-05-26 09:13:57 -04:00 committed by GitHub
parent f4cb16cc2d
commit 00c647e4cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 118 additions and 118 deletions

View file

@ -117,62 +117,62 @@ inline float ref_WrapDegrees_0_360(float f)
void TestUtilities::testAngleWrapAround() {
UASSERT(fabs(modulo360f(100.0) - 100.0) < 0.001);
UASSERT(fabs(modulo360f(720.5) - 0.5) < 0.001);
UASSERT(fabs(modulo360f(-0.5) - (-0.5)) < 0.001);
UASSERT(fabs(modulo360f(-365.5) - (-5.5)) < 0.001);
UASSERT(fabs(modulo360f(100.0) - 100.0) < 0.001);
UASSERT(fabs(modulo360f(720.5) - 0.5) < 0.001);
UASSERT(fabs(modulo360f(-0.5) - (-0.5)) < 0.001);
UASSERT(fabs(modulo360f(-365.5) - (-5.5)) < 0.001);
for (float f = -720; f <= -360; f += 0.25) {
UASSERT(std::fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
}
for (float f = -720; f <= -360; f += 0.25) {
UASSERT(std::fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
}
for (float f = -1440; f <= 1440; f += 0.25) {
UASSERT(std::fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
UASSERT(std::fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
UASSERT(std::fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
UASSERT(wrapDegrees_0_360(
std::fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
}
for (float f = -1440; f <= 1440; f += 0.25) {
UASSERT(std::fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
UASSERT(std::fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
UASSERT(std::fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
UASSERT(wrapDegrees_0_360(
std::fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
}
}
void TestUtilities::testWrapDegrees_0_360_v3f()
{
// only x test with little step
// only x test with little step
for (float x = -720.f; x <= 720; x += 0.05) {
v3f r = wrapDegrees_0_360_v3f(v3f(x, 0, 0));
UASSERT(r.X >= 0.0f && r.X < 360.0f)
UASSERT(r.Y == 0.0f)
UASSERT(r.Z == 0.0f)
}
// only y test with little step
for (float y = -720.f; y <= 720; y += 0.05) {
v3f r = wrapDegrees_0_360_v3f(v3f(0, y, 0));
UASSERT(r.X == 0.0f)
UASSERT(r.Y >= 0.0f && r.Y < 360.0f)
UASSERT(r.Z == 0.0f)
}
// only z test with little step
for (float z = -720.f; z <= 720; z += 0.05) {
v3f r = wrapDegrees_0_360_v3f(v3f(0, 0, z));
UASSERT(r.X == 0.0f)
UASSERT(r.Y == 0.0f)
UASSERT(r.Z >= 0.0f && r.Z < 360.0f)
v3f r = wrapDegrees_0_360_v3f(v3f(x, 0, 0));
UASSERT(r.X >= 0.0f && r.X < 360.0f)
UASSERT(r.Y == 0.0f)
UASSERT(r.Z == 0.0f)
}
// test the whole coordinate translation
for (float x = -720.f; x <= 720; x += 2.5) {
for (float y = -720.f; y <= 720; y += 2.5) {
for (float z = -720.f; z <= 720; z += 2.5) {
v3f r = wrapDegrees_0_360_v3f(v3f(x, y, z));
UASSERT(r.X >= 0.0f && r.X < 360.0f)
UASSERT(r.Y >= 0.0f && r.Y < 360.0f)
UASSERT(r.Z >= 0.0f && r.Z < 360.0f)
}
}
}
// only y test with little step
for (float y = -720.f; y <= 720; y += 0.05) {
v3f r = wrapDegrees_0_360_v3f(v3f(0, y, 0));
UASSERT(r.X == 0.0f)
UASSERT(r.Y >= 0.0f && r.Y < 360.0f)
UASSERT(r.Z == 0.0f)
}
// only z test with little step
for (float z = -720.f; z <= 720; z += 0.05) {
v3f r = wrapDegrees_0_360_v3f(v3f(0, 0, z));
UASSERT(r.X == 0.0f)
UASSERT(r.Y == 0.0f)
UASSERT(r.Z >= 0.0f && r.Z < 360.0f)
}
// test the whole coordinate translation
for (float x = -720.f; x <= 720; x += 2.5) {
for (float y = -720.f; y <= 720; y += 2.5) {
for (float z = -720.f; z <= 720; z += 2.5) {
v3f r = wrapDegrees_0_360_v3f(v3f(x, y, z));
UASSERT(r.X >= 0.0f && r.X < 360.0f)
UASSERT(r.Y >= 0.0f && r.Y < 360.0f)
UASSERT(r.Z >= 0.0f && r.Z < 360.0f)
}
}
}
}