SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
TaoDeFrame.h
1 /* Copyright (c) 2005 Arachi, Inc. and Stanford University. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject
9  * to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
25 #ifndef _deFrame_h
26 #define _deFrame_h
27 
36 class deFrame
37 {
38 public:
40  inline deFrame() { identity(); }
41 
43  inline deFrame(deFloat tx, deFloat ty, deFloat tz)
44  { set(deQuaternion(), deVector3(tx, ty, tz)); }
45 
46  inline deFrame(deFrame const & orig): ori_quat_(orig.ori_quat_), translation_(orig.translation_) {}
47 
49  deQuaternion& rotation() { return ori_quat_; }
51  const deQuaternion& rotation() const { return ori_quat_; }
53  deVector3& translation() { return translation_; }
55  const deVector3& translation() const { return translation_; }
57  DE_MATH_API void identity();
59  DE_MATH_API void operator=(const deFrame & f);
60 
94  DE_MATH_API void multiply(const deFrame& f1, const deFrame& f2);
95 
97  // = ~[r1,p1][r2,p2] = [~r1, -(~r1*p1)][r2,p2] = [~r1*r2, ~r1*p2 - (~r1*p1)]
98  // = [~r1*r2, ~r1*(p2-p1)]
99  DE_MATH_API void inversedMultiply(const deFrame& f1, const deFrame& f2);
101  // = [r1,p1]~[r2,p2] = [r1,p1][~r2, -(~r2*p2)] = [r1*~r2, -r1*(~r2*p2) + p1]
102  // = [r1*~r2, -r1*~r2*p2 + p1]
103  DE_MATH_API void multiplyInversed(const deFrame& f1, const deFrame& f2);
105  // = ~[r,p] = [~r, -(~r*p)]
106  DE_MATH_API void inverse(const deFrame& f);
108  DE_MATH_API void set(const deTransform& t);
110  DE_MATH_API void set(const deQuaternion& q, const deVector3& v);
111 
112 private:
113  deQuaternion ori_quat_;
114  deVector3 translation_;
115 };
116 
117 #endif // _deFrame_h
118 
deFrame(deFloat tx, deFloat ty, deFloat tz)
Definition: TaoDeFrame.h:43
DE_MATH_API void operator=(const deFrame &f)
this = f
Definition: TaoDeFrameInl.h:27
3x1 vector classThis is a C++ wrapper class of deVector3f.
Definition: TaoDeVector3.h:32
DE_MATH_API void identity()
this = identity matrix
Definition: TaoDeFrameInl.h:26
const deQuaternion & rotation() const
Definition: TaoDeFrame.h:51
DE_MATH_API void multiply(const deFrame &f1, const deFrame &f2)
this = f1 * f2 = [r1,p1][r2,p2] = [r1*r2, r1*p2 + p1]
Definition: TaoDeFrameInl.h:29
deQuaternion & rotation()
Definition: TaoDeFrame.h:49
DE_MATH_API void inversedMultiply(const deFrame &f1, const deFrame &f2)
this = f1^-1 * f2
Definition: TaoDeFrameInl.h:37
deFrame()
Definition: TaoDeFrame.h:40
Transformation class using rotational matrixThis class consists of a matrix for rotation and a vector...
Definition: TaoDeTransform.h:32
DE_MATH_API void multiplyInversed(const deFrame &f1, const deFrame &f2)
this = f1 * f2^-1
Definition: TaoDeFrameInl.h:46
Quaternion classThis is a C++ wrapper class of deQuaternionf.
Definition: TaoDeQuaternion.h:35
Transformation class using quaternionThis class consists of a quaternion for rotation and a vector fo...
Definition: TaoDeFrame.h:36
deVector3 & translation()
Definition: TaoDeFrame.h:53
DE_MATH_API void set(const deTransform &t)
this = t
Definition: TaoDeFrameInl.h:57
const deVector3 & translation() const
Definition: TaoDeFrame.h:55
DE_MATH_API void inverse(const deFrame &f)
this = f^-1
Definition: TaoDeFrameInl.h:52