- Timestamp:
- Dec 13, 2008, 11:45:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/bullet/LinearMath/btTransform.h
r2192 r2430 22 22 23 23 24 / //The btTransform class supports rigid transforms with only translation and rotation and no scaling/shear.25 ///It can be used in combination with btVector3, btQuaternion and btMatrix3x3 linear algebra classes. 24 /**@brief The btTransform class supports rigid transforms with only translation and rotation and no scaling/shear. 25 *It can be used in combination with btVector3, btQuaternion and btMatrix3x3 linear algebra classes. */ 26 26 class btTransform { 27 27 … … 29 29 public: 30 30 31 31 /**@brief No initialization constructor */ 32 32 btTransform() {} 33 33 /**@brief Constructor from btQuaternion (optional btVector3 ) 34 * @param q Rotation from quaternion 35 * @param c Translation from Vector (default 0,0,0) */ 34 36 explicit SIMD_FORCE_INLINE btTransform(const btQuaternion& q, 35 37 const btVector3& c = btVector3(btScalar(0), btScalar(0), btScalar(0))) … … 38 40 {} 39 41 42 /**@brief Constructor from btMatrix3x3 (optional btVector3) 43 * @param b Rotation from Matrix 44 * @param c Translation from Vector default (0,0,0)*/ 40 45 explicit SIMD_FORCE_INLINE btTransform(const btMatrix3x3& b, 41 46 const btVector3& c = btVector3(btScalar(0), btScalar(0), btScalar(0))) … … 43 48 m_origin(c) 44 49 {} 45 50 /**@brief Copy constructor */ 46 51 SIMD_FORCE_INLINE btTransform (const btTransform& other) 47 52 : m_basis(other.m_basis), … … 49 54 { 50 55 } 51 56 /**@brief Assignment Operator */ 52 57 SIMD_FORCE_INLINE btTransform& operator=(const btTransform& other) 53 58 { … … 58 63 59 64 65 /**@brief Set the current transform as the value of the product of two transforms 66 * @param t1 Transform 1 67 * @param t2 Transform 2 68 * This = Transform1 * Transform2 */ 60 69 SIMD_FORCE_INLINE void mult(const btTransform& t1, const btTransform& t2) { 61 70 m_basis = t1.m_basis * t2.m_basis; … … 70 79 */ 71 80 72 81 /**@brief Return the transform of the vector */ 73 82 SIMD_FORCE_INLINE btVector3 operator()(const btVector3& x) const 74 83 { … … 78 87 } 79 88 89 /**@brief Return the transform of the vector */ 80 90 SIMD_FORCE_INLINE btVector3 operator*(const btVector3& x) const 81 91 { … … 83 93 } 84 94 95 /**@brief Return the transform of the btQuaternion */ 96 SIMD_FORCE_INLINE btQuaternion operator*(const btQuaternion& q) const 97 { 98 return getRotation() * q; 99 } 100 101 /**@brief Return the basis matrix for the rotation */ 85 102 SIMD_FORCE_INLINE btMatrix3x3& getBasis() { return m_basis; } 103 /**@brief Return the basis matrix for the rotation */ 86 104 SIMD_FORCE_INLINE const btMatrix3x3& getBasis() const { return m_basis; } 87 105 106 /**@brief Return the origin vector translation */ 88 107 SIMD_FORCE_INLINE btVector3& getOrigin() { return m_origin; } 108 /**@brief Return the origin vector translation */ 89 109 SIMD_FORCE_INLINE const btVector3& getOrigin() const { return m_origin; } 90 110 111 /**@brief Return a quaternion representing the rotation */ 91 112 btQuaternion getRotation() const { 92 113 btQuaternion q; … … 96 117 97 118 119 /**@brief Set from an array 120 * @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */ 98 121 void setFromOpenGLMatrix(const btScalar *m) 99 122 { … … 102 125 } 103 126 127 /**@brief Fill an array representation 128 * @param m A pointer to a 15 element array (12 rotation(row major padded on the right by 1), and 3 translation */ 104 129 void getOpenGLMatrix(btScalar *m) const 105 130 { … … 111 136 } 112 137 138 /**@brief Set the translational element 139 * @param origin The vector to set the translation to */ 113 140 SIMD_FORCE_INLINE void setOrigin(const btVector3& origin) 114 141 { … … 119 146 120 147 121 148 /**@brief Set the rotational element by btMatrix3x3 */ 122 149 SIMD_FORCE_INLINE void setBasis(const btMatrix3x3& basis) 123 150 { … … 125 152 } 126 153 154 /**@brief Set the rotational element by btQuaternion */ 127 155 SIMD_FORCE_INLINE void setRotation(const btQuaternion& q) 128 156 { … … 131 159 132 160 133 161 /**@brief Set this transformation to the identity */ 134 162 void setIdentity() 135 163 { … … 138 166 } 139 167 140 168 /**@brief Multiply this Transform by another(this = this * another) 169 * @param t The other transform */ 141 170 btTransform& operator*=(const btTransform& t) 142 171 { … … 146 175 } 147 176 177 /**@brief Return the inverse of this transform */ 148 178 btTransform inverse() const 149 179 { … … 152 182 } 153 183 184 /**@brief Return the inverse of this transform times the other transform 185 * @param t The other transform 186 * return this.inverse() * the other */ 154 187 btTransform inverseTimes(const btTransform& t) const; 155 188 189 /**@brief Return the product of this transform and the other */ 156 190 btTransform operator*(const btTransform& t) const; 157 191 192 /**@brief Return an identity transform */ 158 193 static btTransform getIdentity() 159 194 { … … 164 199 165 200 private: 166 201 ///Storage for the rotation 167 202 btMatrix3x3 m_basis; 203 ///Storage for the translation 168 204 btVector3 m_origin; 169 205 }; … … 192 228 } 193 229 230 /**@brief Test if two transforms have all elements equal */ 194 231 SIMD_FORCE_INLINE bool operator==(const btTransform& t1, const btTransform& t2) 195 232 {
Note: See TracChangeset
for help on using the changeset viewer.