Overte C++ Documentation
AccelerationLimiterFilter.h
1 //
2 // Created by Anthony Thibault 2018/11/09
3 // Copyright 2018 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #ifndef hifi_Controllers_Filters_Acceleration_Limiter_h
10 #define hifi_Controllers_Filters_Acceleration_Limiter_h
11 
12 #include "../Filter.h"
13 
14 namespace controller {
15 
16  class AccelerationLimiterFilter : public Filter {
17  REGISTER_FILTER_CLASS(AccelerationLimiterFilter);
18 
19  public:
20  AccelerationLimiterFilter() {}
21 
22  AxisValue apply(AxisValue value) const override { return value; }
23  Pose apply(Pose value) const override;
24  bool parseParameters(const QJsonValue& parameters) override;
25 
26  private:
27  float _rotationAccelerationLimit { FLT_MAX };
28  float _translationAccelerationLimit { FLT_MAX };
29  float _rotationSnapThreshold { 0.0f };
30  float _translationSnapThreshold { 0.0f };
31 
32  mutable glm::vec3 _prevPos[3]; // sensor space
33  mutable glm::quat _prevRot[3]; // sensor space
34  mutable glm::vec3 _unfilteredPrevPos[3]; // sensor space
35  mutable glm::quat _unfilteredPrevRot[3]; // sensor space
36  mutable bool _prevValid { false };
37  };
38 
39 }
40 
41 #endif