libalmath  1.14.5
almath/types/alrotation.h
00001 /*
00002  * Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
00003  * Use of this source code is governed by a BSD-style license that can be
00004  * found in the COPYING file.
00005  */
00006 
00007 
00008 #pragma once
00009 #ifndef _LIBALMATH_ALMATH_TYPES_ALROTATION_H_
00010 #define _LIBALMATH_ALMATH_TYPES_ALROTATION_H_
00011 
00012 #include <vector>
00013 
00014 namespace AL {
00015   namespace Math {
00016 
00019 
00027 
00028 
00029 
00030     struct Rotation
00031     {
00035       float r1_c1;
00039       float r1_c2;
00043       float r1_c3;
00047       float r2_c1;
00051       float r2_c2;
00055       float r2_c3;
00059       float r3_c1;
00063       float r3_c2;
00067       float r3_c3;
00068 
00071 
00084 
00085       Rotation();
00086 
00095 
00109 
00110 
00111 
00112 
00125 
00126       Rotation (const std::vector<float>& pFloats);
00127 
00132       Rotation& operator*= (const Rotation& pRot2);
00133 
00138       Rotation operator* (const Rotation& pRot2) const;
00139 
00144       bool operator==(const Rotation& pRot2) const;
00145 
00150       bool operator!=(const Rotation& pRot2) const;
00151 
00162       bool isNear(
00163         const Rotation& pRot2,
00164         const float&    pEpsilon=0.0001f) const;
00165 
00172       Rotation transpose() const;
00173 
00177 
00184 
00185 
00186 
00187 
00188       float determinant() const;
00189 
00197       static Rotation fromQuaternion(
00198         const float pA,
00199         const float pB,
00200         const float pC,
00201         const float pD);
00202 
00203 
00211       static Rotation fromAngleDirection(
00212         const float pAngle,
00213         const float pX,
00214         const float pY,
00215         const float pZ);
00216 
00220 
00226 
00227 
00228       static Rotation fromRotX(const float pRotX);
00229 
00233 
00239 
00240 
00241       static Rotation fromRotY(const float pRotY);
00242 
00246 
00252 
00253 
00254       static Rotation fromRotZ(const float pRotZ);
00255 
00265       static Rotation from3DRotation(
00266         const float& pWX,
00267         const float& pWY,
00268         const float& pWZ);
00269 
00273 
00279 
00280       std::vector<float> toVector() const;
00281 
00282     }; // end struct
00283 
00293     Rotation transpose(const Rotation& pRot);
00294 
00295 
00299 
00306 
00307 
00308 
00309 
00310 
00311 
00312     float determinant(const Rotation& pRot);
00313 
00314 
00326     Rotation rotationFromQuaternion(
00327       const float pA,
00328       const float pB,
00329       const float pC,
00330       const float pD);
00331 
00343     Rotation rotationFromAngleDirection(
00344       const float pAngle,
00345       const float pX,
00346       const float pY,
00347       const float pZ);
00348 
00357     void applyRotation(
00358       const AL::Math::Rotation& pRot,
00359       float&                    pX,
00360       float&                    pY,
00361       float&                    pZ);
00362 
00366 
00372 
00373 
00374 
00375 
00376 
00377 
00378     Rotation rotationFromRotX(const float pRotX);
00379 
00383 
00389 
00390 
00391 
00392 
00393 
00394 
00395     Rotation rotationFromRotY(const float pRotY);
00396 
00400 
00405 
00406 
00407 
00408 
00409 
00410 
00411     Rotation rotationFromRotZ(const float pRotZ);
00412 
00425     Rotation rotationFrom3DRotation(
00426       const float& pWX,
00427       const float& pWY,
00428       const float& pWZ);
00429 
00430   }
00431 }
00432 #endif  // _LIBALMATH_ALMATH_TYPES_ALROTATION_H_
 All Classes Namespaces Functions Variables