GteBlendTransformController.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
11 #include <memory>
12 
13 namespace gte
14 {
15 
17 {
18 public:
19  // The transformations consist of translation, rotation, and uniform
20  // scale. The rotation and scale blending is either geometric or
21  // arithmetic, as specified in the other constructor inputs. Translation
22  // blending is always arithmetic. Let {R0,S0,T0} and {R1,S1,T1} be the
23  // transformation channels, and let weight w be in [0,1]. Let {R,S,T} be
24  // the blended result. Let q0, q1, and q be quaternions corresponding to
25  // R0, R1, and R with Dot(q0,q1) >= 0 and A = angle(q0,q1) =
26  // acos(Dot(q0,q1)).
27  //
28  // Translation: T = (1-w)*T0 + w*T1
29  //
30  // Arithmetic rotation: q = Normalize((1-w)*q0 + w*q1)
31  // Geometric rotation:
32  // q = Slerp(w,q0,q1)
33  // = (sin((1-w)*A)*q0 + sin(w*A)*q1)/sin(A)
34  //
35  // Arithmetic scale: s = (1-w)*s0 + w*s1 for each channel s0, s1, s
36  // Geometric scale: s = sign(s0)*sign(s1)*pow(|s0|,1-w)*pow(|s1|,w)
37  // If either of s0 or s1 is zero, then s is zero.
39  std::shared_ptr<TransformController> const& controller0,
40  std::shared_ptr<TransformController> const& controller1,
41  bool geometricRotation, bool geometricScale);
42 
43  // Member access. The weight w is a number for which 0 <= w <= 1.
44  inline std::shared_ptr<TransformController> const& GetController0() const;
45  inline std::shared_ptr<TransformController> const& GetController1() const;
46  inline void SetWeight(float weight);
47  inline float GetWeight() const;
48 
49  // The animation update. The application time is in milliseconds.
50  virtual bool Update(double applicationTime);
51 
52 protected:
53  // Set the object for 'this' and for the managed controllers.
54  virtual void SetObject(ControlledObject* object);
55 
56  std::shared_ptr<TransformController> mController0, mController1;
57  float mWeight;
58  bool mRSMatrices, mGeometricRotation, mGeometricScale;
59 };
60 
61 
62 inline std::shared_ptr<TransformController> const&
64 {
65  return mController0;
66 }
67 
68 inline std::shared_ptr<TransformController> const&
70 {
71  return mController1;
72 }
73 
75 {
76  mWeight = weight;
77 }
78 
80 {
81  return mWeight;
82 }
83 
84 
85 }
std::shared_ptr< TransformController > const & GetController0() const
std::shared_ptr< TransformController > mController1
GLuint GLuint GLfloat weight
Definition: glext.h:9668
std::shared_ptr< TransformController > const & GetController1() const
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59