mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
/* Copyright (C) 2018
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
|
* or distributed except according to the terms contained in the LICENSE file.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKMISC_SIMULATION_INTERPOLATORFUNCTIONS_H
|
|
#define BLACKMISC_SIMULATION_INTERPOLATORFUNCTIONS_H
|
|
|
|
namespace BlackMisc
|
|
{
|
|
namespace Simulation
|
|
{
|
|
//! Valid time fraction [0,1]
|
|
inline bool isValidTimeFraction(double timeFraction)
|
|
{
|
|
return timeFraction >= 0.0 && timeFraction <= 1.0;
|
|
}
|
|
|
|
//! Clamp time fraction [0,1]
|
|
inline double clampValidTimeFraction(double timeFraction)
|
|
{
|
|
if (timeFraction > 1.0) { return 1.0; }
|
|
if (timeFraction < 0.0) { return 0.0; }
|
|
return timeFraction;
|
|
}
|
|
} // namespace
|
|
} // namespace
|
|
#endif // guard
|