kzc_integrate.hpp File Reference

Integration tools. More...

Functions

KANZI_API void kzcIntegrateExponentialDecay (kzFloat *value, kzFloat *derivative, kzFloat halfLife, kzFloat timeStep)
 Integrates a variable whose derivative decays exponentially over a given time step. More...
 

Detailed Description

Integration tools.

Copyright 2008-2017 by Rightware. All rights reserved.

Function Documentation

KANZI_API void kzcIntegrateExponentialDecay ( kzFloat value,
kzFloat derivative,
kzFloat  halfLife,
kzFloat  timeStep 
)

Integrates a variable whose derivative decays exponentially over a given time step.

Updates 'value' and 'derivative' with their values after the given amount of time. Parameter halfLife is the half life of the derivative.

Example: Movement of value 'x' starts with speed 'v' and 'v' halves every 2 seconds. Solution: kzcIntegrateExponentialDecay(&x, &v, 2.0f, deltaTimeMs / 1000.0f);