STYLE: use clamp/clamp_range instead of min(max(..., upper), lower)

This commit is contained in:
Mark Olesen
2023-02-01 18:39:19 +01:00
parent ba6667a344
commit 1cc72ea7e3
50 changed files with 122 additions and 167 deletions

View File

@ -114,7 +114,7 @@ namespace vectorTools
scalar cosPhi = (a & b)/(mag(a)*mag(b) + tolerance);
// Enforce bounding between -1 and 1
return min(max(cosPhi, -1), 1);
return clamp(cosPhi, -1, 1);
}
//- Calculate angle between a and b in radians
@ -129,7 +129,7 @@ namespace vectorTools
scalar cosPhi = (a & b)/(mag(a)*mag(b) + tolerance);
// Enforce bounding between -1 and 1
return acos( min(max(cosPhi, -1), 1) );
return acos(clamp(cosPhi, -1, 1));
}
//- Calculate angle between a and b in degrees