Revision 7ede6000
utility/quaternion.h | ||
---|---|---|
157 | 157 |
Matrix<3> toMatrix() const |
158 | 158 |
{ |
159 | 159 |
Matrix<3> ret; |
160 |
ret.cell(0, 0) = 1-(2*(_y*_y))-(2*(_z*_z));
|
|
161 |
ret.cell(0, 1) = (2*_x*_y)-(2*_w*_z);
|
|
162 |
ret.cell(0, 2) = (2*_x*_z)+(2*_w*_y);
|
|
160 |
ret.cell(0, 0) = 1 - 2*_y*_y - 2*_z*_z;
|
|
161 |
ret.cell(0, 1) = 2*_x*_y - 2*_w*_z;
|
|
162 |
ret.cell(0, 2) = 2*_x*_z + 2*_w*_y;
|
|
163 | 163 |
|
164 |
ret.cell(1, 0) = (2*_x*_y)+(2*_w*_z);
|
|
165 |
ret.cell(1, 1) = 1-(2*(_x*_x))-(2*(_z*_z));
|
|
166 |
ret.cell(1, 2) = (2*(_y*_z))-(2*(_w*_x));
|
|
164 |
ret.cell(1, 0) = 2*_x*_y + 2*_w*_z;
|
|
165 |
ret.cell(1, 1) = 1 - 2*_x*_x - 2*_z*_z;
|
|
166 |
ret.cell(1, 2) = 2*_y*_z - 2*_w*_x;
|
|
167 | 167 |
|
168 |
ret.cell(2, 0) = (2*(_x*_z))-(2*_w*_y);
|
|
169 |
ret.cell(2, 1) = (2*_y*_z)+(2*_w*_x);
|
|
170 |
ret.cell(2, 2) = 1-(2*(_x*_x))-(2*(_y*_y));
|
|
168 |
ret.cell(2, 0) = 2*_x*_z - 2*_w*_y;
|
|
169 |
ret.cell(2, 1) = 2*_y*_z + 2*_w*_x;
|
|
170 |
ret.cell(2, 2) = 1 - 2*_x*_x - 2*_y*_y;
|
|
171 | 171 |
return ret; |
172 | 172 |
} |
173 | 173 |
|
Also available in: Unified diff