HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CL_Spring Class Reference

#include <CL_Spring.h>

Public Types

enum  Method { Method::POSITION, Method::FORCE }
 Method used to compute the spring filter. Either position or force. More...
 

Static Public Member Functions

template<class F >
static void solve (const fpreal *data, fpreal *result, int size, fpreal spring_constant, fpreal mass, fpreal damping_constant, fpreal inc, Method method, const F &interrupt)
 
static void solve (const fpreal *data, fpreal *result, int size, fpreal spring_constant, fpreal mass, fpreal damping_constant, fpreal inc, Method method)
 
template<class F >
static void solve (const fpreal *data, fpreal *result, int size, fpreal spring_constant, fpreal mass, fpreal damping_constant, fpreal inc, fpreal initial_displacement, fpreal initial_velocity, Method method, const F &interrupt)
 
static void solve (const fpreal *data, fpreal *result, int size, fpreal spring_constant, fpreal mass, fpreal damping_constant, fpreal inc, fpreal initial_displacement, fpreal initial_velocity, Method method)
 
template<class F >
static bool solveRealtime (const F &get_data, fpreal *result, int size, fpreal spring_constant, fpreal mass, fpreal damping_constant, fpreal inc, fpreal &d1, fpreal &d2, Method method)
 

Detailed Description

Definition at line 24 of file CL_Spring.h.

Member Enumeration Documentation

enum CL_Spring::Method
strong

Method used to compute the spring filter. Either position or force.

Enumerator
POSITION 
FORCE 

Definition at line 29 of file CL_Spring.h.

Member Function Documentation

template<class F >
void CL_Spring::solve ( const fpreal data,
fpreal result,
int  size,
fpreal  spring_constant,
fpreal  mass,
fpreal  damping_constant,
fpreal  inc,
Method  method,
const F &  interrupt 
)
inlinestatic

Solve for a spring filter given input data data and result must both be of length size computes initial displacement and initial velocity automatically based on the input data

Definition at line 144 of file CL_Spring.h.

static void CL_Spring::solve ( const fpreal data,
fpreal result,
int  size,
fpreal  spring_constant,
fpreal  mass,
fpreal  damping_constant,
fpreal  inc,
Method  method 
)
inlinestatic

Solve for a spring filter given input data data and result must both be of length size computes initial displacement and initial velocity automatically based on the input data Note: This method is an overload for the above, allowing the user to avoid passing in a lambda for the interrupt method. With c++17 support, this could be more gracefully handled using inline variables:

static inline auto defaultInterruptor = []() { return false; }; template <typename f="decltype(defaultInterruptor)"> static void foo(const F &interrupt = defaultInterruptor) {}

Definition at line 59 of file CL_Spring.h.

template<class F >
void CL_Spring::solve ( const fpreal data,
fpreal result,
int  size,
fpreal  spring_constant,
fpreal  mass,
fpreal  damping_constant,
fpreal  inc,
fpreal  initial_displacement,
fpreal  initial_velocity,
Method  method,
const F &  interrupt 
)
inlinestatic

Solve for a spring filter given input data data and result must both be of length size initial displacement and initial velocity are passed in manually

Definition at line 123 of file CL_Spring.h.

static void CL_Spring::solve ( const fpreal data,
fpreal result,
int  size,
fpreal  spring_constant,
fpreal  mass,
fpreal  damping_constant,
fpreal  inc,
fpreal  initial_displacement,
fpreal  initial_velocity,
Method  method 
)
inlinestatic

Definition at line 78 of file CL_Spring.h.

template<class F >
bool CL_Spring::solveRealtime ( const F &  get_data,
fpreal result,
int  size,
fpreal  spring_constant,
fpreal  mass,
fpreal  damping_constant,
fpreal  inc,
fpreal d1,
fpreal d2,
Method  method 
)
inlinestatic

Spring solver for realtime data Must provide a lambda (get_data) which returns the data value given the result index

Returns
bool - whether or not the solution is steady
d1, d2 - output parameters d1 and d2 are updated in place

Definition at line 166 of file CL_Spring.h.


The documentation for this class was generated from the following file: