mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- fixed PointOnSide functions to consider 'on the line' as 'in front of'.
The bad code was taken from the 2005 floating point rewrite that, by comparing the value with '> -EQUAL_EPSILON', returned 1 for any value close to 0 (as 'on the line') so it was mistakenly reported as 'behind the line'.
This commit is contained in:
parent
c6fb35ed52
commit
fc3682006a
1 changed files with 9 additions and 4 deletions
|
@ -38,17 +38,22 @@ struct intercept_t
|
|||
|
||||
inline int P_PointOnLineSidePrecise(double x, double y, const line_t *line)
|
||||
{
|
||||
return (y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - x) * line->Delta().Y > -EQUAL_EPSILON;
|
||||
return (y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - x) * line->Delta().Y > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
inline int P_PointOnLineSidePrecise(const DVector2 &pt, const line_t *line)
|
||||
{
|
||||
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > -EQUAL_EPSILON;
|
||||
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
extern line_t *lines;
|
||||
inline int P_PointOnLineSide (double x, double y, const line_t *line)
|
||||
{
|
||||
extern int P_VanillaPointOnLineSide(double x, double y, const line_t* line);
|
||||
if (line - lines == 6180)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
return i_compatflags2 & COMPATF2_POINTONLINE
|
||||
? P_VanillaPointOnLineSide(x, y, line) : P_PointOnLineSidePrecise(x, y, line);
|
||||
|
@ -73,12 +78,12 @@ inline int P_PointOnLineSide(const DVector2 & p, const line_t *line)
|
|||
|
||||
inline int P_PointOnDivlineSide(double x, double y, const divline_t *line)
|
||||
{
|
||||
return (y - line->y) * line->dx + (line->x - x) * line->dy > -EQUAL_EPSILON;
|
||||
return (y - line->y) * line->dx + (line->x - x) * line->dy > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
inline int P_PointOnDivlineSide(const DVector2 &pos, const divline_t *line)
|
||||
{
|
||||
return (pos.Y - line->y) * line->dx + (line->x - pos.X) * line->dy > -EQUAL_EPSILON;
|
||||
return (pos.Y - line->y) * line->dx + (line->x - pos.X) * line->dy > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue