mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Ref T709, improved normalization and space pressed handling, unit test
This commit is contained in:
committed by
Mat Sutcliffe
parent
cdffc11c99
commit
add649c321
@@ -92,6 +92,16 @@ namespace BlackMisc
|
||||
return tokens;
|
||||
}
|
||||
|
||||
//! Normalize value to range start -> end (like for +-180degrees)
|
||||
inline double normalizeValue(const double value, const double start, const double end)
|
||||
{
|
||||
// https://stackoverflow.com/questions/1628386/normalise-orientation-between-0-and-360
|
||||
if (value >= start && value <= end) { return value; }
|
||||
const double width = end - start ;
|
||||
const double offsetValue = value - start; // value relative to 0
|
||||
return (offsetValue - (floor(offsetValue / width) * width)) + start ;
|
||||
}
|
||||
|
||||
//! ACF properties
|
||||
struct AcfProperties
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user