swift
Loading...
Searching...
No Matches
interpolatorfunctions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORFUNCTIONS_H
7#define SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORFUNCTIONS_H
8
9namespace swift::misc::simulation
10{
12 inline bool isValidTimeFraction(double timeFraction) { return timeFraction >= 0.0 && timeFraction <= 1.0; }
13
15 inline bool isAcceptableTimeFraction(double timeFraction) { return timeFraction >= 0.0 && timeFraction <= 1.01; }
16
18 inline double clampValidTimeFraction(double timeFraction)
19 {
20 if (timeFraction > 1.0)
21 {
22 return 1.0;
23 }
24 if (timeFraction < 0.0)
25 {
26 return 0.0;
27 }
28 return timeFraction;
29 }
30} // namespace swift::misc::simulation
31#endif // SWIFT_MISC_SIMULATION_INTERPOLATION_INTERPOLATORFUNCTIONS_H
bool isValidTimeFraction(double timeFraction)
Valid time fraction [0,1].
bool isAcceptableTimeFraction(double timeFraction)
Valid time fraction [0,1], this allows minor overshooting.
double clampValidTimeFraction(double timeFraction)
Clamp time fraction [0,1].