Fix bug in SGMisc<T>:: normalizePeriodic()
SGMisc<T>::normalizePeriodic(min,max,value) returned zero for all values less than min. Example: A call of normalizePeriodic(0,twopi(),-pi()) returned zero where the correct value would be 3*pi().
This commit is contained in:
@@ -65,7 +65,7 @@ public:
|
|||||||
return min;
|
return min;
|
||||||
T normalized = value - range*floor((value - min)/range);
|
T normalized = value - range*floor((value - min)/range);
|
||||||
// two security checks that can only happen due to roundoff
|
// two security checks that can only happen due to roundoff
|
||||||
if (value <= min)
|
if (normalized <= min)
|
||||||
return min;
|
return min;
|
||||||
if (max <= normalized)
|
if (max <= normalized)
|
||||||
return min;
|
return min;
|
||||||
|
|||||||
Reference in New Issue
Block a user