mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user