- inlined Clipper::PointToAngle

This commit is contained in:
Christoph Oelckers 2021-04-10 10:56:11 +02:00
parent 2e191f2742
commit 35221188db
2 changed files with 23 additions and 24 deletions

View file

@ -358,29 +358,6 @@ void Clipper::DoRemoveClipRange(angle_t start, angle_t end)
//
//-----------------------------------------------------------------------------
binangle Clipper::PointToAngle(const vec2_t& pos)
{
vec2_t vec = pos - viewpoint;
#if 0
if (vec.x == 0 && vec.y == 0)
{
return 0;
}
else
{
double result = vec.y / double(abs(vec.x) + fabs(vec.y));
if (vec.x < 0)
{
result = 2. - result;
}
return bamang(xs_Fix<30>::ToFix(result));
}
#else
return bvectangbam(vec.x, vec.y);
#endif
}
void Clipper::DumpClipper()
{
for (auto node = cliphead; node; node = node->next)

View file

@ -144,7 +144,29 @@ public:
void DumpClipper();
binangle PointToAngle(const vec2_t& point);
binangle PointToAngle(const vec2_t& pos)
{
vec2_t vec = pos - viewpoint;
#if 0
if (vec.x == 0 && vec.y == 0)
{
return bamang(0);
}
else
{
double result = vec.y / double(abs(vec.x) + fabs(vec.y));
if (vec.x < 0)
{
result = 2. - result;
}
return bamang(xs_Fix<30>::ToFix(result));
}
#else
return bvectangbam(vec.x, vec.y);
#endif
}
};