This commit is contained in:
MPC 2018-12-20 18:52:51 -03:00
parent fcb65951b8
commit 9d93f54b67
3 changed files with 5 additions and 24 deletions

View file

@ -121,16 +121,6 @@ fixed_t FixedHypot(fixed_t x, fixed_t y)
return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2)
}
fixed_t FixedEuclidean(fixed_t x2, fixed_t y2, fixed_t x1, fixed_t y1)
{
INT64 dx = x2-x1;
INT64 dy = y2-y1;
union {INT64 i; float x;} u;
u.x = (dx*dx+dy*dy);
u.i = (1<<29) + (u.i >> 1) - (1<<22);
return (fixed_t)llrintf(u.x);
}
vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y)
{
vec->x = x;

View file

@ -237,17 +237,6 @@ FUNCMATH fixed_t FixedSqrt(fixed_t x);
*/
FUNCMATH fixed_t FixedHypot(fixed_t x, fixed_t y);
/** \brief The FixedEuclidean function
\param x fixed_t number
\param y fixed_t number
\return sqrt(x*x+y*y)
*/
fixed_t FixedEuclidean(fixed_t x2, fixed_t y2, fixed_t x1, fixed_t y1);
/** \brief The FixedFloor function
\param x fixed_t number

View file

@ -389,7 +389,9 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum)
*/
fixed_t P_SegLength(seg_t *seg)
{
return FixedEuclidean(seg->v2->x,seg->v2->y,seg->v1->x,seg->v1->y);
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
return FixedHypot(dx, dy)<<1;
}
#ifdef HWRENDER