Overte C++ Documentation
RotationConstraint.h
1 //
2 // RotationConstraint.h
3 //
4 // Copyright 2015 High Fidelity, Inc.
5 //
6 // Distributed under the Apache License, Version 2.0.
7 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
8 //
9 
10 #ifndef hifi_RotationConstraint_h
11 #define hifi_RotationConstraint_h
12 
13 #include <glm/glm.hpp>
14 #include <glm/gtc/quaternion.hpp>
15 
16 class RotationConstraint {
17 public:
18  RotationConstraint() : _referenceRotation() {}
19  virtual ~RotationConstraint() {}
20 
22  virtual void setReferenceRotation(const glm::quat& rotation) { _referenceRotation = rotation; }
23 
25  const glm::quat& getReferenceRotation() const { return _referenceRotation; }
26 
29  virtual bool apply(glm::quat& rotation) const = 0;
30 
32  virtual bool isLowerSpine() const { return false; }
33 
36  virtual void dynamicallyAdjustLimits(const glm::quat& rotation) {}
37 
39  virtual void clearHistory() {};
40 
42  virtual glm::quat computeCenterRotation() const = 0;
43 
44 protected:
45  glm::quat _referenceRotation = glm::quat();
46 };
47 
48 #endif // hifi_RotationConstraint_h