30 #ifndef MCL_3DL_FILTER_H
31 #define MCL_3DL_FILTER_H
54 inline Filter(
const enum type_t type,
const float time_const,
const float out0,
const bool angle =
false)
61 k_[3] = -1 / (1.0 + 2 * time_const);
63 k_[1] = (1.0 - 2 * time_const) *
k_[3];
65 x_ = (1 -
k_[2]) * out0 /
k_[3];
68 k_[3] = -1 / (1.0 + 2 * time_const);
69 k_[2] = -
k_[3] * 2 * time_const;
70 k_[1] = (1.0 - 2 * time_const) *
k_[3];
71 k_[0] = 2 * time_const * (-
k_[1] + 1.0);
72 x_ = (1 -
k_[2]) * out0 /
k_[3];
76 inline void set(
const float out0)
78 x_ = (1 -
k_[2]) * out0 /
k_[3];
83 assert(std::isfinite(
in));
92 assert(std::isfinite(
out_));
95 inline float get()
const
102 #endif // MCL_3DL_FILTER_H