Add some more !isnan assertions.
This commit is contained in:
parent
6956514425
commit
6be424604f
2 changed files with 10 additions and 2 deletions
|
|
@ -19,7 +19,12 @@ int SlowMultiplierMinusOne/* = 0*/;
|
|||
} // namespace
|
||||
|
||||
transition linear = [](const float64 &delta, const float64 &dt) {
|
||||
return delta * dt;
|
||||
Expects(!std::isnan(delta));
|
||||
Expects(!std::isnan(dt));
|
||||
|
||||
const auto result = delta * dt;
|
||||
Ensures(!std::isnan(result));
|
||||
return result;
|
||||
};
|
||||
|
||||
transition sineInOut = [](const float64 &delta, const float64 &dt) {
|
||||
|
|
|
|||
|
|
@ -345,9 +345,12 @@ inline void Simple::start(
|
|||
Assert(!std::isnan(that->delta));
|
||||
Assert(!std::isnan(that->duration));
|
||||
const auto finished = (time >= that->duration);
|
||||
Assert(finished || that->duration > 0);
|
||||
const auto progressRatio = finished ? 1. : time / that->duration;
|
||||
Assert(!std::isnan(progressRatio));
|
||||
const auto progress = finished
|
||||
? that->delta
|
||||
: that->transition(that->delta, time / that->duration);
|
||||
: that->transition(that->delta, progressRatio);
|
||||
Assert(!std::isnan(that->from));
|
||||
Assert(!std::isnan(progress));
|
||||
that->value = that->from + progress;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue