1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAMaya. 5 6 Portions of the code are: 7 Copyright (c) 2005-2007 Feeling Software Inc. 8 Copyright (c) 2005-2007 Sony Computer Entertainment America 9 Copyright (c) 2004-2005 Alias Systems Corp. 10 11 Licensed under the MIT Open Source License, 12 for details please see LICENSE file or the website 13 http://www.opensource.org/licenses/mit-license.php 14 */ 15 16 #ifndef __COLLADA_MAYA_ROTATE_HELPER_H__ 17 #define __COLLADA_MAYA_ROTATE_HELPER_H__ 18 19 #include "COLLADAMayaPrerequisites.h" 20 #include <vector> 21 22 namespace COLLADAMaya 23 { 24 25 /** 26 * Generates the rotation matrix, depending on the rotation order. 27 */ 28 class RotateHelper 29 { 30 31 private: 32 33 /** The euler rotation with the rotation order to set. */ 34 MEulerRotation rotation; 35 36 /** The rotation matrix to generate, depending on the rotation order. */ 37 std::vector< std::vector<double> > rotationMatrix; 38 39 /** The vector with the rotation parameters in the rotation order. */ 40 std::vector<String> rotationParameters; 41 42 public: 43 44 /** 45 * Constructor. 46 * @param rotation The euler rotation. 47 */ 48 RotateHelper( const MEulerRotation & rotation ); 49 50 /** 51 * Returns the rotation vector (2x3 matrix). 52 * @return std::vector< std::vector<double> >& 53 */ getRotationMatrix()54 std::vector < std::vector<double> >& getRotationMatrix () 55 { 56 return rotationMatrix; 57 } 58 59 /** 60 * Returns the rotation parameters in the rotation order. 61 * @return std::vector<String>& 62 */ getRotationParameters()63 std::vector<String>& getRotationParameters () 64 { 65 return rotationParameters; 66 } 67 68 bool isIdentity(double tolerance) const; 69 70 private: 71 72 /** 73 * Creates the rotation. 74 */ 75 void createRotation ( ); 76 77 void createX ( uint pos ); 78 79 void createY ( uint pos ); 80 81 void createZ ( uint pos ); 82 83 }; 84 } 85 86 #endif /* __COLLADA_MAYA_ROTATE_HELPER_H__ */ 87 88