All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzc_integrate.h File Reference

Integration tools. More...

Functions

KZ_HEADER_BEGIN 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-2020 by Rightware. All rights reserved.

Function Documentation

KZ_HEADER_BEGIN 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);