DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2006 Torus Knot Software Ltd Also see acknowledgements in Readme.html This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt. You may alternatively use this source under the terms of a specific version of the OGRE Unrestricted License provided you have obtained such a license from Torus Knot Software Ltd. ----------------------------------------------------------------------------- */ #ifndef __Matrix3_H__ #define __Matrix3_H__ #include "OgrePrerequisites.h" #include "OgreVector3.h" // NB All code adapted from Wild Magic 0.2 Matrix math (free source code) // http://www.geometrictools.com/ // NOTE. The (x,y,z) coordinate system is assumed to be right-handed. // Coordinate axis rotation matrices are of the form // RX = 1 0 0 // 0 cos(t) -sin(t) // 0 sin(t) cos(t) // where t > 0 indicates a counterclockwise rotation in the yz-plane // RY = cos(t) 0 sin(t) // 0 1 0 // -sin(t) 0 cos(t) // where t > 0 indicates a counterclockwise rotation in the zx-plane // RZ = cos(t) -sin(t) 0 // sin(t) cos(t) 0 // 0 0 1 // where t > 0 indicates a counterclockwise rotation in the xy-plane. namespace Ogre { /** A 3x3 matrix which can represent rotations around axes. @note
All the code is adapted from the Wild Magic 0.2 Matrix library (http://www.geometrictools.com/).
@par The coordinate system is assumed to be
right-handed
. */ class _OgreExport Matrix3 { public: /** Default constructor. @note It does
NOT
initialize the matrix for efficiency. */ inline Matrix3 () {}; inline explicit Matrix3 (const Real arr[3][3]) { memcpy(m,arr,9*sizeof(Real)); } inline Matrix3 (const Matrix3& rkMatrix) { memcpy(m,rkMatrix.m,9*sizeof(Real)); } Matrix3 (Real fEntry00, Real fEntry01, Real fEntry02, Real fEntry10, Real fEntry11, Real fEntry12, Real fEntry20, Real fEntry21, Real fEntry22) { m[0][0] = fEntry00; m[0][1] = fEntry01; m[0][2] = fEntry02; m[1][0] = fEntry10; m[1][1] = fEntry11; m[1][2] = fEntry12; m[2][0] = fEntry20; m[2][1] = fEntry21; m[2][2] = fEntry22; } // member access, allows use of construct mat[r][c] inline Real* operator[] (size_t iRow) const { return (Real*)m[iRow]; } /*inline operator Real* () { return (Real*)m[0]; }*/ Vector3 GetColumn (size_t iCol) const; void SetColumn(size_t iCol, const Vector3& vec); void FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis); // assignment and comparison inline Matrix3& operator= (const Matrix3& rkMatrix) { memcpy(m,rkMatrix.m,9*sizeof(Real)); return *this; } bool operator== (const Matrix3& rkMatrix) const; inline bool operator!= (const Matrix3& rkMatrix) const { return !operator==(rkMatrix); } // arithmetic operations Matrix3 operator+ (const Matrix3& rkMatrix) const; Matrix3 operator- (const Matrix3& rkMatrix) const; Matrix3 operator* (const Matrix3& rkMatrix) const; Matrix3 operator- () const; // matrix * vector [3x3 * 3x1 = 3x1] Vector3 operator* (const Vector3& rkVector) const; // vector * matrix [1x3 * 3x3 = 1x3] _OgreExport friend Vector3 operator* (const Vector3& rkVector, const Matrix3& rkMatrix); // matrix * scalar Matrix3 operator* (Real fScalar) const; // scalar * matrix _OgreExport friend Matrix3 operator* (Real fScalar, const Matrix3& rkMatrix); // utilities Matrix3 Transpose () const; bool Inverse (Matrix3& rkInverse, Real fTolerance = 1e-06) const; Matrix3 Inverse (Real fTolerance = 1e-06) const; Real Determinant () const; // singular value decomposition void SingularValueDecomposition (Matrix3& rkL, Vector3& rkS, Matrix3& rkR) const; void SingularValueComposition (const Matrix3& rkL, const Vector3& rkS, const Matrix3& rkR); // Gram-Schmidt orthonormalization (applied to columns of rotation matrix) void Orthonormalize (); // orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12) void QDUDecomposition (Matrix3& rkQ, Vector3& rkD, Vector3& rkU) const; Real SpectralNorm () const; // matrix must be orthonormal void ToAxisAngle (Vector3& rkAxis, Radian& rfAngle) const; inline void ToAxisAngle (Vector3& rkAxis, Degree& rfAngle) const { Radian r; ToAxisAngle ( rkAxis, r ); rfAngle = r; } void FromAxisAngle (const Vector3& rkAxis, const Radian& fRadians); #ifndef OGRE_FORCE_ANGLE_TYPES inline void ToAxisAngle (Vector3& rkAxis, Real& rfRadians) const { Radian r; ToAxisAngle ( rkAxis, r ); rfRadians = r.valueRadians(); } inline void FromAxisAngle (const Vector3& rkAxis, Real fRadians) { FromAxisAngle ( rkAxis, Radian(fRadians) ); } #endif//OGRE_FORCE_ANGLE_TYPES // The matrix must be orthonormal. The decomposition is yaw*pitch*roll // where yaw is rotation about the Up vector, pitch is rotation about the // Right axis, and roll is rotation about the Direction axis. bool ToEulerAnglesXYZ (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; bool ToEulerAnglesXZY (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; bool ToEulerAnglesYXZ (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; bool ToEulerAnglesYZX (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; bool ToEulerAnglesZXY (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; bool ToEulerAnglesZYX (Radian& rfYAngle, Radian& rfPAngle, Radian& rfRAngle) const; void FromEulerAnglesXYZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); void FromEulerAnglesXZY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); void FromEulerAnglesYXZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); void FromEulerAnglesYZX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); void FromEulerAnglesZXY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); void FromEulerAnglesZYX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle); #ifndef OGRE_FORCE_ANGLE_TYPES inline bool ToEulerAnglesXYZ (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesXYZ(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline bool ToEulerAnglesXZY (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesXZY(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline bool ToEulerAnglesYXZ (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesYXZ(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline bool ToEulerAnglesYZX (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesYZX(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline bool ToEulerAnglesZXY (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesZXY(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline bool ToEulerAnglesZYX (float& rfYAngle, float& rfPAngle, float& rfRAngle) const { Radian y, p, r; bool b = ToEulerAnglesZYX(y,p,r); rfYAngle = y.valueRadians(); rfPAngle = p.valueRadians(); rfRAngle = r.valueRadians(); return b; } inline void FromEulerAnglesXYZ (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesXYZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } inline void FromEulerAnglesXZY (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesXZY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } inline void FromEulerAnglesYXZ (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesYXZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } inline void FromEulerAnglesYZX (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesYZX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } inline void FromEulerAnglesZXY (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesZXY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } inline void FromEulerAnglesZYX (float fYAngle, float fPAngle, float fRAngle) { FromEulerAnglesZYX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) ); } #endif//OGRE_FORCE_ANGLE_TYPES // eigensolver, matrix must be symmetric void EigenSolveSymmetric (Real afEigenvalue[3], Vector3 akEigenvector[3]) const; static void TensorProduct (const Vector3& rkU, const Vector3& rkV, Matrix3& rkProduct); static const Real EPSILON; static const Matrix3 ZERO; static const Matrix3 IDENTITY; protected: // support for eigensolver void Tridiagonal (Real afDiag[3], Real afSubDiag[3]); bool QLAlgorithm (Real afDiag[3], Real afSubDiag[3]); // support for singular value decomposition static const Real ms_fSvdEpsilon; static const unsigned int ms_iSvdMaxIterations; static void Bidiagonalize (Matrix3& kA, Matrix3& kL, Matrix3& kR); static void GolubKahanStep (Matrix3& kA, Matrix3& kL, Matrix3& kR); // support for spectral norm static Real MaxCubicRoot (Real afCoeff[3]); Real m[3][3]; // for faster access friend class Matrix4; }; } #endif
OgreMatrix3.h
Page URL
File URL
Prev
91/217
Next
Download
( 11 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.