SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
TaoDeTransformInl.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  */
22 
23 #ifndef _deTransform_inl
24 #define _deTransform_inl
25 
26 DE_MATH_API deMatrix3& deTransform::rotation() { return _m; }
27 DE_MATH_API const deMatrix3& deTransform::rotation() const { return _m; }
28 DE_MATH_API deVector3& deTransform::translation() { return _v; }
29 DE_MATH_API const deVector3& deTransform::translation() const { return _v; }
30 
31 DE_MATH_API void deTransform::identity() { _m.identity(); _v.zero(); }
32 DE_MATH_API void deTransform::operator=(const deTransform& t) { _m = t._m; _v = t._v; }
34 DE_MATH_API void deTransform::multiply(const deTransform& t1, const deTransform& t2) {
35  _m.multiply(t1.rotation(), t2.rotation());
36  _v.multiply(t1.rotation(), t2.translation());
37  _v += t1.translation();
38 }
40 DE_MATH_API void deTransform::inverse(const deTransform& t) {
41  _m.transpose(t.rotation());
42  _v.multiply(_m, t.translation());
43  _v.negate(_v);
44 }
46 DE_MATH_API void deTransform::inversedMultiply(const deTransform& t1, const deTransform& t2) {
47  deVector3 p;
48  p.subtract(t2.translation(), t1.translation());
49  _v.transposedMultiply(t1.rotation(), p);
50  _m.transposedMultiply(t1.rotation(), t2.rotation());
51 }
53 DE_MATH_API void deTransform::multiplyInversed(const deTransform& t1, const deTransform& t2)
54 {
55  _m.multiplyTransposed(t1.rotation(), t2.rotation());
56  _v.multiply(_m, t2.translation());
57  _v.subtract(t1.translation(), _v);
58 }
59 DE_MATH_API void deTransform::set(const deFrame& f) { _m.set(f.rotation()); _v = f.translation(); }
60 DE_MATH_API void deTransform::set(const deMatrix3& m, const deVector3& v) { _m = m; _v = v; }
61 
62 #endif // _deTransform_inl
63 
DE_MATH_API void transpose(const deMatrix3 &m)
this = m^T
Definition: TaoDeMatrix3Inl.h:50
3x1 vector classThis is a C++ wrapper class of deVector3f.
Definition: TaoDeVector3.h:32
DE_MATH_API void set(const deFrame &f)
this = f
Definition: TaoDeTransformInl.h:59
DE_MATH_API void operator=(const deTransform &t)
this = t
Definition: TaoDeTransformInl.h:32
DE_MATH_API void inversedMultiply(const deTransform &t1, const deTransform &t2)
this = ~[r1,p1][r2,p2] = [~r1, -(~r1*p1)][r2,p2] = [~r1*r2, ~r1*(p2-p1)]
Definition: TaoDeTransformInl.h:46
DE_MATH_API void transposedMultiply(const deMatrix3 &m1, const deMatrix3 &m2)
this = m1^T * m2
Definition: TaoDeMatrix3Inl.h:35
deQuaternion & rotation()
Definition: TaoDeFrame.h:49
DE_MATH_API void identity()
this = identity matrix
Definition: TaoDeMatrix3Inl.h:30
DE_MATH_API deMatrix3 & rotation()
Definition: TaoDeTransformInl.h:26
Transformation class using rotational matrixThis class consists of a matrix for rotation and a vector...
Definition: TaoDeTransform.h:32
DE_MATH_API void multiplyTransposed(const deMatrix3 &m1, const deMatrix3 &m2)
this = m1 * m2^T
Definition: TaoDeMatrix3Inl.h:36
DE_MATH_API void multiply(const deMatrix3 &m1, const deMatrix3 &m2)
this = m1 * m2
Definition: TaoDeMatrix3Inl.h:34
DE_MATH_API void multiplyInversed(const deTransform &t1, const deTransform &t2)
this = [r1,p1]~[r2,p2] = [r1,p1][~r2, -(~r2*p2)] = [(r1*~r2), p1-(r1*~r2)*p2]
Definition: TaoDeTransformInl.h:53
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 inverse(const deTransform &t)
this = ~[r,p] = [~r, -(~r*p)]
Definition: TaoDeTransformInl.h:40
DE_MATH_API void subtract(const deVector3 &v1, const deVector3 &v2)
this = v1 - v2
Definition: TaoDeVector3Inl.h:47
DE_MATH_API void set(const deQuaternion &q)
this = q
Definition: TaoDeMatrix3Inl.h:55
DE_MATH_API void multiply(const deTransform &t1, const deTransform &t2)
this = [r1,p1][r2,p2] = [r1*r2, r1*p2 + p1]
Definition: TaoDeTransformInl.h:34
3x3 matrix classThis is a C++ wrapper class of deMatrix3f.
Definition: TaoDeMatrix3.h:33
DE_MATH_API deVector3 & translation()
Definition: TaoDeTransformInl.h:28
DE_MATH_API void transposedMultiply(const deMatrix3 &m, const deVector3 &v)
this = m^T * v
Definition: TaoDeVector3Inl.h:53
DE_MATH_API void zero()
this = 0
Definition: TaoDeVector3Inl.h:38
DE_MATH_API void negate(const deVector3 &v)
this = -v
Definition: TaoDeVector3Inl.h:45
DE_MATH_API void multiply(const deVector3 &v1, const deVector3 &v2)
this[i] = v1[i] * v2[i]
Definition: TaoDeVector3Inl.h:48
DE_MATH_API void identity()
this = identity matrix
Definition: TaoDeTransformInl.h:31