Core: Replace C math headers with C++ equivalents

- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
This commit is contained in:
Thaddeus Crews
2025-03-19 14:18:09 -05:00
parent c5c1cd4440
commit ad40939b6f
101 changed files with 414 additions and 498 deletions

View File

@@ -370,13 +370,13 @@ static float perpendicular_distance(const Vector2 &i, const Vector2 &start, cons
float intercept;
if (start.x == end.x) {
res = Math::absf(i.x - end.x);
res = Math::abs(i.x - end.x);
} else if (start.y == end.y) {
res = Math::absf(i.y - end.y);
res = Math::abs(i.y - end.y);
} else {
slope = (end.y - start.y) / (end.x - start.x);
intercept = start.y - (slope * start.x);
res = Math::absf(slope * i.x - i.y + intercept) / Math::sqrt(Math::pow(slope, 2.0f) + 1.0);
res = Math::abs(slope * i.x - i.y + intercept) / Math::sqrt(Math::pow(slope, 2.0f) + 1.0);
}
return res;
}