summaryrefslogtreecommitdiffhomepage
path: root/src/raycast.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-28 23:45:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-28 23:45:55 +0100
commit396513259863963bf14453bbbf41dfddbc31ef7d (patch)
tree1bc0fb97028984c68a2022b76a2f0a9e5797176e /src/raycast.cpp
parent6686d167103d6b9afb505c06a60a23b0bd008cd9 (diff)
wording: long/short -> major/minor
Diffstat (limited to 'src/raycast.cpp')
-rw-r--r--src/raycast.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/raycast.cpp b/src/raycast.cpp
index 92d81452..603b7606 100644
--- a/src/raycast.cpp
+++ b/src/raycast.cpp
@@ -136,27 +136,27 @@ raycast_result_s do_raycasting(std::conditional_t<EnableDiagnostics, raycast_dia
if (abs(dir.x()) < eps && abs(dir.y()) < eps) [[unlikely]]
dir = {eps, eps};
- unsigned long_axis, short_axis;
+ unsigned major_axis, minor_axis;
if (abs(dir.y()) > abs(dir.x()))
{
- long_axis = 1;
- short_axis = 0;
+ major_axis = 1;
+ minor_axis = 0;
}
else
{
- long_axis = 0;
- short_axis = 1;
+ major_axis = 0;
+ minor_axis = 1;
}
- auto long_len = max(1u, (unsigned)ceil(abs(V[long_axis]))),
- short_len = max(1u, (unsigned)ceil(abs(V[short_axis])));
+ auto major_len = max(1u, (unsigned)ceil(abs(V[major_axis]))),
+ minor_lenj = max(1u, (unsigned)ceil(abs(V[minor_axis])));
auto nsteps = 1u;
- nsteps = max(nsteps, (short_len+tile_size<unsigned>.x()-1)/tile_size<unsigned>.x());
- nsteps = max(nsteps, (long_len+chunk_size<unsigned>.x()-1)/chunk_size<unsigned>.x());
+ nsteps = max(nsteps, (minor_lenj +tile_size<unsigned>.x()-1)/tile_size<unsigned>.x());
+ nsteps = max(nsteps, (major_len +chunk_size<unsigned>.x()-1)/chunk_size<unsigned>.x());
auto size_ = Vector2ui{};
- size_[short_axis] = (short_len+nsteps*2-1) / nsteps;
- size_[long_axis] = (long_len+nsteps-1) / nsteps;
+ size_[minor_axis] = (minor_lenj +nsteps*2-1) / nsteps;
+ size_[major_axis] = (major_len +nsteps-1) / nsteps;
auto dir_inv_norm = Vector2(abs(dir.x()) < eps ? copysign(inv_eps, dir.x()) : 1 / dir.x(),
abs(dir.y()) < eps ? copysign(inv_eps, dir.y()) : 1 / dir.y());
@@ -202,7 +202,7 @@ raycast_result_s do_raycasting(std::conditional_t<EnableDiagnostics, raycast_dia
if (k == 0)
{
- for (auto axis : { long_axis, short_axis })
+ for (auto axis : { major_axis, minor_axis })
{
auto sign = sign_<int>(V[axis]);
pos[axis] += (int)(size[axis]/4) * sign;
@@ -213,13 +213,13 @@ raycast_result_s do_raycasting(std::conditional_t<EnableDiagnostics, raycast_dia
{
constexpr auto add = (tile_size<unsigned>.x()+1)/2,
min_size = tile_size<unsigned>.x() + add;
- if (size[long_axis] > min_size)
+ if (size[major_axis] > min_size)
{
- auto sign = sign_<int>(V[long_axis]);
- auto off = (int)(size[long_axis]/2) - (int)add;
+ auto sign = sign_<int>(V[major_axis]);
+ auto off = (int)(size[major_axis]/2) - (int)add;
fm_debug_assert(off >= 0);
- pos[long_axis] -= off/2 * sign;
- size[long_axis] -= (unsigned)off;
+ pos[major_axis] -= off/2 * sign;
+ size[major_axis] -= (unsigned)off;
}
}