use w and h for radii in ellipse intersects

This commit is contained in:
jacekpoz 2024-08-13 14:19:56 +02:00
parent 2eb53fb8a3
commit e994825668
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -138,9 +138,9 @@ inline bool rect_intersects(const PtkRect r, const PtkPos p) {
inline bool ellipse_intersects(const PtkEllipse e, const PtkPos p) { inline bool ellipse_intersects(const PtkEllipse e, const PtkPos p) {
const float x = p.x - e.center.x; const float x = p.x - e.center.x;
const float rx = e.radii.x; const float rx = e.radii.w;
const float y = p.y - e.center.y; const float y = p.y - e.center.y;
const float ry = e.radii.y; const float ry = e.radii.h;
return ((x * x) / (rx * rx)) + ((y * y) / (ry * ry)) <= 1.0f; return ((x * x) / (rx * rx)) + ((y * y) / (ry * ry)) <= 1.0f;
} }