1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreMatrix3.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
10 | <h1>OgreMatrix3.h</h1><a href="OgreMatrix3_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 <span class="preprocessor">#ifndef __Matrix3_H__</span> |
---|
35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define __Matrix3_H__</span> |
---|
36 | 00027 <span class="preprocessor"></span> |
---|
37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
38 | 00029 |
---|
39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgreVector3_8h.html">OgreVector3.h</a>"</span> |
---|
40 | 00031 |
---|
41 | 00032 <span class="comment">// NB All code adapted from Wild Magic 0.2 Matrix math (free source code)</span> |
---|
42 | 00033 <span class="comment">// http://www.magic-software.com</span> |
---|
43 | 00034 |
---|
44 | 00035 <span class="comment">// NOTE. The (x,y,z) coordinate system is assumed to be right-handed.</span> |
---|
45 | 00036 <span class="comment">// Coordinate axis rotation matrices are of the form</span> |
---|
46 | 00037 <span class="comment">// RX = 1 0 0</span> |
---|
47 | 00038 <span class="comment">// 0 cos(t) -sin(t)</span> |
---|
48 | 00039 <span class="comment">// 0 sin(t) cos(t)</span> |
---|
49 | 00040 <span class="comment">// where t > 0 indicates a counterclockwise rotation in the yz-plane</span> |
---|
50 | 00041 <span class="comment">// RY = cos(t) 0 sin(t)</span> |
---|
51 | 00042 <span class="comment">// 0 1 0</span> |
---|
52 | 00043 <span class="comment">// -sin(t) 0 cos(t)</span> |
---|
53 | 00044 <span class="comment">// where t > 0 indicates a counterclockwise rotation in the zx-plane</span> |
---|
54 | 00045 <span class="comment">// RZ = cos(t) -sin(t) 0</span> |
---|
55 | 00046 <span class="comment">// sin(t) cos(t) 0</span> |
---|
56 | 00047 <span class="comment">// 0 0 1</span> |
---|
57 | 00048 <span class="comment">// where t > 0 indicates a counterclockwise rotation in the xy-plane.</span> |
---|
58 | 00049 |
---|
59 | 00050 <span class="keyword">namespace </span>Ogre |
---|
60 | 00051 { |
---|
61 | <a name="l00059"></a><a class="code" href="classOgre_1_1Matrix3.html">00059</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> Matrix3 |
---|
62 | 00060 { |
---|
63 | 00061 <span class="keyword">public</span>: |
---|
64 | <a name="l00066"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a0">00066</a> <span class="keyword">inline</span> Matrix3 () {}; |
---|
65 | <a name="l00067"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a1">00067</a> <span class="keyword">inline</span> <span class="keyword">explicit</span> Matrix3 (<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a420">Real</a> arr[3][3]) |
---|
66 | 00068 { |
---|
67 | 00069 memcpy(m,arr,9*<span class="keyword">sizeof</span>(<a class="code" href="namespaceOgre.html#a420">Real</a>)); |
---|
68 | 00070 } |
---|
69 | <a name="l00071"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a2">00071</a> <span class="keyword">inline</span> Matrix3 (<span class="keyword">const</span> Matrix3& rkMatrix) |
---|
70 | 00072 { |
---|
71 | 00073 memcpy(m,rkMatrix.<a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3p0">m</a>,9*<span class="keyword">sizeof</span>(<a class="code" href="namespaceOgre.html#a420">Real</a>)); |
---|
72 | 00074 } |
---|
73 | <a name="l00075"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a3">00075</a> Matrix3 (<a class="code" href="namespaceOgre.html#a420">Real</a> fEntry00, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry01, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry02, |
---|
74 | 00076 <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry10, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry11, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry12, |
---|
75 | 00077 <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry20, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry21, <a class="code" href="namespaceOgre.html#a420">Real</a> fEntry22) |
---|
76 | 00078 { |
---|
77 | 00079 m[0][0] = fEntry00; |
---|
78 | 00080 m[0][1] = fEntry01; |
---|
79 | 00081 m[0][2] = fEntry02; |
---|
80 | 00082 m[1][0] = fEntry10; |
---|
81 | 00083 m[1][1] = fEntry11; |
---|
82 | 00084 m[1][2] = fEntry12; |
---|
83 | 00085 m[2][0] = fEntry20; |
---|
84 | 00086 m[2][1] = fEntry21; |
---|
85 | 00087 m[2][2] = fEntry22; |
---|
86 | 00088 } |
---|
87 | 00089 |
---|
88 | 00090 <span class="comment">// member access, allows use of construct mat[r][c]</span> |
---|
89 | <a name="l00091"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a4">00091</a> <span class="keyword">inline</span> <a class="code" href="namespaceOgre.html#a420">Real</a>* operator[] (size_t iRow)<span class="keyword"> const</span> |
---|
90 | 00092 <span class="keyword"> </span>{ |
---|
91 | 00093 <span class="keywordflow">return</span> (<a class="code" href="namespaceOgre.html#a420">Real</a>*)m[iRow]; |
---|
92 | 00094 } |
---|
93 | 00095 <span class="comment">/*inline operator Real* ()</span> |
---|
94 | 00096 <span class="comment"> {</span> |
---|
95 | 00097 <span class="comment"> return (Real*)m[0];</span> |
---|
96 | 00098 <span class="comment"> }*/</span> |
---|
97 | 00099 <a class="code" href="classOgre_1_1Vector3.html">Vector3</a> GetColumn (size_t iCol) <span class="keyword">const</span>; |
---|
98 | 00100 <span class="keywordtype">void</span> SetColumn(size_t iCol, <span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& vec); |
---|
99 | 00101 <span class="keywordtype">void</span> FromAxes(<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& xAxis, <span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& yAxis, <span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& zAxis); |
---|
100 | 00102 |
---|
101 | 00103 <span class="comment">// assignment and comparison</span> |
---|
102 | <a name="l00104"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a8">00104</a> <span class="keyword">inline</span> Matrix3& operator= (<span class="keyword">const</span> Matrix3& rkMatrix) |
---|
103 | 00105 { |
---|
104 | 00106 memcpy(m,rkMatrix.<a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3p0">m</a>,9*<span class="keyword">sizeof</span>(<a class="code" href="namespaceOgre.html#a420">Real</a>)); |
---|
105 | 00107 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
106 | 00108 } |
---|
107 | 00109 <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a618">operator== </a>(<span class="keyword">const</span> Matrix3& rkMatrix) <span class="keyword">const</span>; |
---|
108 | <a name="l00110"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a10">00110</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a619">operator!= </a>(<span class="keyword">const</span> Matrix3& rkMatrix)<span class="keyword"> const</span> |
---|
109 | 00111 <span class="keyword"> </span>{ |
---|
110 | 00112 <span class="keywordflow">return</span> !<a class="code" href="namespaceOgre.html#a618">operator==</a>(rkMatrix); |
---|
111 | 00113 } |
---|
112 | 00114 |
---|
113 | 00115 <span class="comment">// arithmetic operations</span> |
---|
114 | 00116 Matrix3 operator+ (<span class="keyword">const</span> Matrix3& rkMatrix) <span class="keyword">const</span>; |
---|
115 | 00117 Matrix3 operator- (<span class="keyword">const</span> Matrix3& rkMatrix) <span class="keyword">const</span>; |
---|
116 | 00118 Matrix3 <a class="code" href="namespaceOgre.html#a612">operator* </a>(<span class="keyword">const</span> Matrix3& rkMatrix) <span class="keyword">const</span>; |
---|
117 | 00119 Matrix3 operator- () <span class="keyword">const</span>; |
---|
118 | 00120 |
---|
119 | 00121 <span class="comment">// matrix * vector [3x3 * 3x1 = 3x1]</span> |
---|
120 | 00122 <a class="code" href="classOgre_1_1Vector3.html">Vector3</a> <a class="code" href="namespaceOgre.html#a612">operator* </a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkVector) <span class="keyword">const</span>; |
---|
121 | 00123 |
---|
122 | 00124 <span class="comment">// vector * matrix [1x3 * 3x3 = 1x3]</span> |
---|
123 | 00125 <a class="code" href="class__OgreExport.html">_OgreExport</a> <span class="keyword">friend</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a> <a class="code" href="namespaceOgre.html#a612">operator* </a>(<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkVector, |
---|
124 | 00126 <span class="keyword">const</span> Matrix3& rkMatrix); |
---|
125 | 00127 |
---|
126 | 00128 <span class="comment">// matrix * scalar</span> |
---|
127 | 00129 Matrix3 <a class="code" href="namespaceOgre.html#a612">operator* </a>(<a class="code" href="namespaceOgre.html#a420">Real</a> fScalar) <span class="keyword">const</span>; |
---|
128 | 00130 |
---|
129 | 00131 <span class="comment">// scalar * matrix</span> |
---|
130 | 00132 <a class="code" href="class__OgreExport.html">_OgreExport</a> <span class="keyword">friend</span> Matrix3 <a class="code" href="namespaceOgre.html#a612">operator* </a>(<a class="code" href="namespaceOgre.html#a420">Real</a> fScalar, <span class="keyword">const</span> Matrix3& rkMatrix); |
---|
131 | 00133 |
---|
132 | 00134 <span class="comment">// utilities</span> |
---|
133 | 00135 Matrix3 Transpose () <span class="keyword">const</span>; |
---|
134 | 00136 <span class="keywordtype">bool</span> Inverse (Matrix3& rkInverse, <a class="code" href="namespaceOgre.html#a420">Real</a> fTolerance = 1e-06) <span class="keyword">const</span>; |
---|
135 | 00137 Matrix3 Inverse (<a class="code" href="namespaceOgre.html#a420">Real</a> fTolerance = 1e-06) <span class="keyword">const</span>; |
---|
136 | 00138 <a class="code" href="namespaceOgre.html#a420">Real</a> Determinant () <span class="keyword">const</span>; |
---|
137 | 00139 |
---|
138 | 00140 <span class="comment">// singular value decomposition</span> |
---|
139 | 00141 <span class="keywordtype">void</span> SingularValueDecomposition (Matrix3& rkL, <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkS, |
---|
140 | 00142 Matrix3& rkR) <span class="keyword">const</span>; |
---|
141 | 00143 <span class="keywordtype">void</span> SingularValueComposition (<span class="keyword">const</span> Matrix3& rkL, |
---|
142 | 00144 <span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkS, <span class="keyword">const</span> Matrix3& rkR); |
---|
143 | 00145 |
---|
144 | 00146 <span class="comment">// Gram-Schmidt orthonormalization (applied to columns of rotation matrix)</span> |
---|
145 | 00147 <span class="keywordtype">void</span> Orthonormalize (); |
---|
146 | 00148 |
---|
147 | 00149 <span class="comment">// orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)</span> |
---|
148 | 00150 <span class="keywordtype">void</span> QDUDecomposition (Matrix3& rkQ, <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkD, |
---|
149 | 00151 <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkU) <span class="keyword">const</span>; |
---|
150 | 00152 |
---|
151 | 00153 <a class="code" href="namespaceOgre.html#a420">Real</a> SpectralNorm () <span class="keyword">const</span>; |
---|
152 | 00154 |
---|
153 | 00155 <span class="comment">// matrix must be orthonormal</span> |
---|
154 | 00156 <span class="keywordtype">void</span> ToAxisAngle (<a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkAxis, <a class="code" href="classOgre_1_1Radian.html">Radian</a>& rfAngle) <span class="keyword">const</span>; |
---|
155 | <a name="l00157"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3a27">00157</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> ToAxisAngle (<a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkAxis, <a class="code" href="classOgre_1_1Degree.html">Degree</a>& rfAngle)<span class="keyword"> const </span>{ |
---|
156 | 00158 <a class="code" href="classOgre_1_1Radian.html">Radian</a> r; |
---|
157 | 00159 ToAxisAngle ( rkAxis, r ); |
---|
158 | 00160 rfAngle = r; |
---|
159 | 00161 } |
---|
160 | 00162 <span class="keywordtype">void</span> FromAxisAngle (<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkAxis, <span class="keyword">const</span> <a class="code" href="classOgre_1_1Radian.html">Radian</a>& fRadians); |
---|
161 | 00163 <span class="preprocessor">#ifndef OGRE_FORCE_ANGLE_TYPES</span> |
---|
162 | 00164 <span class="preprocessor"></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> ToAxisAngle (<a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkAxis, <a class="code" href="namespaceOgre.html#a420">Real</a>& rfRadians)<span class="keyword"> const </span>{ |
---|
163 | 00165 <a class="code" href="classOgre_1_1Radian.html">Radian</a> r; |
---|
164 | 00166 ToAxisAngle ( rkAxis, r ); |
---|
165 | 00167 rfRadians = r.<a class="code" href="classOgre_1_1Radian.html#Ogre_1_1Radiana6">valueRadians</a>(); |
---|
166 | 00168 } |
---|
167 | 00169 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromAxisAngle (<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkAxis, <a class="code" href="namespaceOgre.html#a420">Real</a> fRadians) { |
---|
168 | 00170 FromAxisAngle ( rkAxis, Radian(fRadians) ); |
---|
169 | 00171 } |
---|
170 | 00172 <span class="preprocessor">#endif//OGRE_FORCE_ANGLE_TYPES</span> |
---|
171 | 00173 <span class="preprocessor"></span> |
---|
172 | 00174 <span class="comment">// The matrix must be orthonormal. The decomposition is yaw*pitch*roll</span> |
---|
173 | 00175 <span class="comment">// where yaw is rotation about the Up vector, pitch is rotation about the</span> |
---|
174 | 00176 <span class="comment">// Right axis, and roll is rotation about the Direction axis.</span> |
---|
175 | 00177 <span class="keywordtype">bool</span> ToEulerAnglesXYZ (Radian& rfYAngle, Radian& rfPAngle, |
---|
176 | 00178 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
177 | 00179 <span class="keywordtype">bool</span> ToEulerAnglesXZY (Radian& rfYAngle, Radian& rfPAngle, |
---|
178 | 00180 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
179 | 00181 <span class="keywordtype">bool</span> ToEulerAnglesYXZ (Radian& rfYAngle, Radian& rfPAngle, |
---|
180 | 00182 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
181 | 00183 <span class="keywordtype">bool</span> ToEulerAnglesYZX (Radian& rfYAngle, Radian& rfPAngle, |
---|
182 | 00184 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
183 | 00185 <span class="keywordtype">bool</span> ToEulerAnglesZXY (Radian& rfYAngle, Radian& rfPAngle, |
---|
184 | 00186 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
185 | 00187 <span class="keywordtype">bool</span> ToEulerAnglesZYX (Radian& rfYAngle, Radian& rfPAngle, |
---|
186 | 00188 Radian& rfRAngle) <span class="keyword">const</span>; |
---|
187 | 00189 <span class="keywordtype">void</span> FromEulerAnglesXYZ (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
188 | 00190 <span class="keywordtype">void</span> FromEulerAnglesXZY (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
189 | 00191 <span class="keywordtype">void</span> FromEulerAnglesYXZ (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
190 | 00192 <span class="keywordtype">void</span> FromEulerAnglesYZX (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
191 | 00193 <span class="keywordtype">void</span> FromEulerAnglesZXY (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
192 | 00194 <span class="keywordtype">void</span> FromEulerAnglesZYX (<span class="keyword">const</span> Radian& fYAngle, <span class="keyword">const</span> Radian& fPAngle, <span class="keyword">const</span> Radian& fRAngle); |
---|
193 | 00195 <span class="preprocessor">#ifndef OGRE_FORCE_ANGLE_TYPES</span> |
---|
194 | 00196 <span class="preprocessor"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesXYZ (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
195 | 00197 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
196 | 00198 Radian y, p, r; |
---|
197 | 00199 <span class="keywordtype">bool</span> b = ToEulerAnglesXYZ(y,p,r); |
---|
198 | 00200 rfYAngle = y.valueRadians(); |
---|
199 | 00201 rfPAngle = p.valueRadians(); |
---|
200 | 00202 rfRAngle = r.valueRadians(); |
---|
201 | 00203 <span class="keywordflow">return</span> b; |
---|
202 | 00204 } |
---|
203 | 00205 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesXZY (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
204 | 00206 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
205 | 00207 Radian y, p, r; |
---|
206 | 00208 <span class="keywordtype">bool</span> b = ToEulerAnglesXZY(y,p,r); |
---|
207 | 00209 rfYAngle = y.valueRadians(); |
---|
208 | 00210 rfPAngle = p.valueRadians(); |
---|
209 | 00211 rfRAngle = r.valueRadians(); |
---|
210 | 00212 <span class="keywordflow">return</span> b; |
---|
211 | 00213 } |
---|
212 | 00214 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesYXZ (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
213 | 00215 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
214 | 00216 Radian y, p, r; |
---|
215 | 00217 <span class="keywordtype">bool</span> b = ToEulerAnglesYXZ(y,p,r); |
---|
216 | 00218 rfYAngle = y.valueRadians(); |
---|
217 | 00219 rfPAngle = p.valueRadians(); |
---|
218 | 00220 rfRAngle = r.valueRadians(); |
---|
219 | 00221 <span class="keywordflow">return</span> b; |
---|
220 | 00222 } |
---|
221 | 00223 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesYZX (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
222 | 00224 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
223 | 00225 Radian y, p, r; |
---|
224 | 00226 <span class="keywordtype">bool</span> b = ToEulerAnglesYZX(y,p,r); |
---|
225 | 00227 rfYAngle = y.valueRadians(); |
---|
226 | 00228 rfPAngle = p.valueRadians(); |
---|
227 | 00229 rfRAngle = r.valueRadians(); |
---|
228 | 00230 <span class="keywordflow">return</span> b; |
---|
229 | 00231 } |
---|
230 | 00232 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesZXY (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
231 | 00233 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
232 | 00234 Radian y, p, r; |
---|
233 | 00235 <span class="keywordtype">bool</span> b = ToEulerAnglesZXY(y,p,r); |
---|
234 | 00236 rfYAngle = y.valueRadians(); |
---|
235 | 00237 rfPAngle = p.valueRadians(); |
---|
236 | 00238 rfRAngle = r.valueRadians(); |
---|
237 | 00239 <span class="keywordflow">return</span> b; |
---|
238 | 00240 } |
---|
239 | 00241 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ToEulerAnglesZYX (<span class="keywordtype">float</span>& rfYAngle, <span class="keywordtype">float</span>& rfPAngle, |
---|
240 | 00242 <span class="keywordtype">float</span>& rfRAngle)<span class="keyword"> const </span>{ |
---|
241 | 00243 Radian y, p, r; |
---|
242 | 00244 <span class="keywordtype">bool</span> b = ToEulerAnglesZYX(y,p,r); |
---|
243 | 00245 rfYAngle = y.valueRadians(); |
---|
244 | 00246 rfPAngle = p.valueRadians(); |
---|
245 | 00247 rfRAngle = r.valueRadians(); |
---|
246 | 00248 <span class="keywordflow">return</span> b; |
---|
247 | 00249 } |
---|
248 | 00250 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesXYZ (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
249 | 00251 FromEulerAnglesXYZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
250 | 00252 } |
---|
251 | 00253 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesXZY (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
252 | 00254 FromEulerAnglesXZY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
253 | 00255 } |
---|
254 | 00256 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesYXZ (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
255 | 00257 FromEulerAnglesYXZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
256 | 00258 } |
---|
257 | 00259 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesYZX (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
258 | 00260 FromEulerAnglesYZX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
259 | 00261 } |
---|
260 | 00262 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesZXY (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
261 | 00263 FromEulerAnglesZXY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
262 | 00264 } |
---|
263 | 00265 <span class="keyword">inline</span> <span class="keywordtype">void</span> FromEulerAnglesZYX (<span class="keywordtype">float</span> fYAngle, <span class="keywordtype">float</span> fPAngle, <span class="keywordtype">float</span> fRAngle) { |
---|
264 | 00266 FromEulerAnglesZYX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); |
---|
265 | 00267 } |
---|
266 | 00268 <span class="preprocessor">#endif//OGRE_FORCE_ANGLE_TYPES</span> |
---|
267 | 00269 <span class="preprocessor"></span> <span class="comment">// eigensolver, matrix must be symmetric</span> |
---|
268 | 00270 <span class="keywordtype">void</span> EigenSolveSymmetric (<a class="code" href="namespaceOgre.html#a420">Real</a> afEigenvalue[3], |
---|
269 | 00271 <a class="code" href="classOgre_1_1Vector3.html">Vector3</a> akEigenvector[3]) <span class="keyword">const</span>; |
---|
270 | 00272 |
---|
271 | 00273 <span class="keyword">static</span> <span class="keywordtype">void</span> TensorProduct (<span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkU, <span class="keyword">const</span> <a class="code" href="classOgre_1_1Vector3.html">Vector3</a>& rkV, |
---|
272 | 00274 Matrix3& rkProduct); |
---|
273 | 00275 |
---|
274 | <a name="l00276"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3s0">00276</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a420">Real</a> EPSILON; |
---|
275 | <a name="l00277"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3s1">00277</a> <span class="keyword">static</span> <span class="keyword">const</span> Matrix3 ZERO; |
---|
276 | <a name="l00278"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3s2">00278</a> <span class="keyword">static</span> <span class="keyword">const</span> Matrix3 IDENTITY; |
---|
277 | 00279 |
---|
278 | 00280 <span class="keyword">protected</span>: |
---|
279 | 00281 <span class="comment">// support for eigensolver</span> |
---|
280 | 00282 <span class="keywordtype">void</span> Tridiagonal (<a class="code" href="namespaceOgre.html#a420">Real</a> afDiag[3], <a class="code" href="namespaceOgre.html#a420">Real</a> afSubDiag[3]); |
---|
281 | 00283 <span class="keywordtype">bool</span> QLAlgorithm (<a class="code" href="namespaceOgre.html#a420">Real</a> afDiag[3], <a class="code" href="namespaceOgre.html#a420">Real</a> afSubDiag[3]); |
---|
282 | 00284 |
---|
283 | 00285 <span class="comment">// support for singular value decomposition</span> |
---|
284 | <a name="l00286"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3t0">00286</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a420">Real</a> ms_fSvdEpsilon; |
---|
285 | <a name="l00287"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3t1">00287</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ms_iSvdMaxIterations; |
---|
286 | 00288 <span class="keyword">static</span> <span class="keywordtype">void</span> Bidiagonalize (Matrix3& kA, Matrix3& kL, |
---|
287 | 00289 Matrix3& kR); |
---|
288 | 00290 <span class="keyword">static</span> <span class="keywordtype">void</span> GolubKahanStep (Matrix3& kA, Matrix3& kL, |
---|
289 | 00291 Matrix3& kR); |
---|
290 | 00292 |
---|
291 | 00293 <span class="comment">// support for spectral norm</span> |
---|
292 | 00294 <span class="keyword">static</span> <a class="code" href="namespaceOgre.html#a420">Real</a> MaxCubicRoot (<a class="code" href="namespaceOgre.html#a420">Real</a> afCoeff[3]); |
---|
293 | 00295 |
---|
294 | <a name="l00296"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3p0">00296</a> <a class="code" href="namespaceOgre.html#a420">Real</a> m[3][3]; |
---|
295 | 00297 |
---|
296 | 00298 <span class="comment">// for faster access</span> |
---|
297 | <a name="l00299"></a><a class="code" href="classOgre_1_1Matrix3.html#Ogre_1_1Matrix3n0">00299</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOgre_1_1Matrix4.html">Matrix4</a>; |
---|
298 | 00300 }; |
---|
299 | 00301 } |
---|
300 | 00302 <span class="preprocessor">#endif</span> |
---|
301 | </pre></div><hr> |
---|
302 | <p> |
---|
303 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
304 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
305 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
306 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
307 | <Work rdf:about=""> |
---|
308 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
309 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
310 | </Work> |
---|
311 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
312 | |
---|
313 | Last modified Sun Feb 12 12:59:47 2006 |
---|
314 | </p> |
---|
315 | </body> |
---|
316 | </html> |
---|