Skip to content

Commit

Permalink
Minor refactor in RecastMesh.cpp (recastnavigation#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamemechanicwow authored Sep 4, 2023
1 parent 1adf911 commit cd89890
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Recast/Source/RecastMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,21 @@ static bool between(const int* a, const int* b, const int* c)
// If ab not vertical, check betweenness on x; else on y.
if (a[0] != b[0])
return ((a[0] <= c[0]) && (c[0] <= b[0])) || ((a[0] >= c[0]) && (c[0] >= b[0]));
else
return ((a[2] <= c[2]) && (c[2] <= b[2])) || ((a[2] >= c[2]) && (c[2] >= b[2]));

return ((a[2] <= c[2]) && (c[2] <= b[2])) || ((a[2] >= c[2]) && (c[2] >= b[2]));
}

// Returns true iff segments ab and cd intersect, properly or improperly.
static bool intersect(const int* a, const int* b, const int* c, const int* d)
{
if (intersectProp(a, b, c, d))
return true;
else if (between(a, b, c) || between(a, b, d) ||
between(c, d, a) || between(c, d, b))

if (between(a, b, c) || between(a, b, d) ||
between(c, d, a) || between(c, d, b))
return true;
else
return false;

return false;
}

static bool vequal(const int* a, const int* b)
Expand Down

0 comments on commit cd89890

Please sign in to comment.