SPIDAR API Library  0x16033101
Space Interface Device for Artificial Reality
Pose.hpp
Go to the documentation of this file.
1 
5 #ifndef SPIDAR_POSE_HPP
6 #define SPIDAR_POSE_HPP
7 
8 namespace Spidar
9 {
10 namespace Core
11 {
18 template <class V, class Q>
19 struct Pose
20 {
21  typedef V VectorType;
22  typedef Q QuaternionType;
23 
24  VectorType position;
25  QuaternionType rotation;
26  VectorType velocity;
27  VectorType angularVelocity;
28 
30  void clear(void)
31  {
32  position = VectorType();
33  rotation = QuaternionType();
34  velocity = VectorType();
35  angularVelocity = VectorType();
36  }
37 
38  void lerp(const Pose& from, const Pose& to, double t, Pose& result);
39 
40 }; // end of struct Pose.
41 
51 template <class V, class Q>
52 void Pose<V,Q>::lerp(const Pose<V,Q>& from, const Pose<V,Q>& to, double t, Pose<V,Q>& result)
53 {
54  typedef V VectorType;
55  typedef Q QuaternionType;
56 
57  if (t<0) t = 0;
58  if (t>1) t = 1;
59 
60  result.position = VectorType::lerp(from.position, to.position, t);
61  result.velocity = VectorType::lerp(from.velocity, to.velocity, t);
62  result.rotation = QuaternionType::slerp(from.rotation, to.rotation, t);
63  result.angularVelocity = VectorType::lerp(from.angularVelocity, to.angularVelocity, t);
64 }
65 
66 } // end of namespace Core.
67 } // end of namespace Spidar.
68 
69 #endif // SPIDAR_POSE_HPP
70 
71 // end of file.
void clear(void)
値の消去
Definition: Pose.hpp:30
SPIDARライブラリのルート名前空間です.
QuaternionType rotation
回転
Definition: Pose.hpp:25
VectorType position
位置 [m]
Definition: Pose.hpp:24
グリップの姿勢を保持するクラスです.
Definition: Pose.hpp:19
VectorType angularVelocity
角速度 [rad/s]
Definition: Pose.hpp:27
void lerp(const Pose &from, const Pose &to, double t, Pose &result)
グリップ姿勢を線形補間する関数です.
Definition: Pose.hpp:52
Q QuaternionType
四元数の型
Definition: Pose.hpp:22
V VectorType
ベクトルの型
Definition: Pose.hpp:21
VectorType velocity
速度 [m/s]
Definition: Pose.hpp:26