7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 22:05:32 +00:00

BOX2: Correct a clamp

std::clamp is (v, min, max), but alg::clamp is (min, v, max).

I can't quite get my head round why this only causes test failures
on some platforms.
This commit is contained in:
John Beard 2024-10-09 08:28:58 +08:00
parent 55370e7520
commit 58669f2b9f

View File

@ -855,8 +855,8 @@ public:
me.Normalize(); // ensure size is >= 0
// Determine closest point to the circle centre within this rect
const coord_type nx = std::clamp( me.GetLeft(), aPoint.x, me.GetRight() );
const coord_type ny = std::clamp( me.GetTop(), aPoint.y, me.GetBottom() );
const coord_type nx = std::clamp( aPoint.x, me.GetLeft(), me.GetRight() );
const coord_type ny = std::clamp( aPoint.y, me.GetTop(), me.GetBottom() );
return Vec( nx, ny );
}