Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# SbRotation.h

    00001 #ifndef COIN_SBROTATION_H
    00002 #define COIN_SBROTATION_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <stdio.h>
    00028 #include <Inventor/SbVec4f.h>
    00029
    00030 class SbMatrix;
    00031 class SbVec3f;
    00032
    00033 class COIN_DLL_API SbRotation {
    00034 public:
    00035   SbRotation(void);
    00036   SbRotation(const SbVec3f & axis, const float radians);
    00037   SbRotation(const float q[4]);
    00038   SbRotation(const float q0, const float q1, const float q2, const float q3);
    00039   SbRotation(const SbMatrix & m);
    00040   SbRotation(const SbVec3f & rotateFrom, const SbVec3f & rotateTo);
    00041   const float * getValue(void) const;
    00042   void getValue(float & q0, float & q1, float & q2, float & q3) const;
    00043   SbRotation & setValue(const float q0, const float q1,
    00044                         const float q2, const float q3);
    00045   void getValue(SbVec3f & axis, float & radians) const;
    00046   void getValue(SbMatrix & matrix) const;
    00047   SbRotation & invert(void);
    00048   SbRotation inverse(void) const;
    00049   SbRotation & setValue(const float q[4]);
    00050   SbRotation & setValue(const SbMatrix & m);
    00051   SbRotation & setValue(const SbVec3f & axis, const float radians);
    00052   SbRotation & setValue(const SbVec3f & rotateFrom, const SbVec3f & rotateTo);
    00053   SbRotation & operator*=(const SbRotation & q);
    00054   SbRotation & operator*=(const float s);
    00055   friend COIN_DLL_API int operator==(const SbRotation & q1, const SbRotation & q2);
    00056   friend COIN_DLL_API int operator!=(const SbRotation & q1, const SbRotation & q2);
    00057   SbBool equals(const SbRotation & r, const float tolerance) const;
    00058   friend COIN_DLL_API SbRotation operator *(const SbRotation & q1, const SbRotation & q2);
    00059   void multVec(const SbVec3f & src, SbVec3f & dst) const;
    00060
    00061   void scaleAngle(const float scaleFactor);
    00062   static SbRotation slerp(const SbRotation & rot0, const SbRotation & rot1,
    00063                           float t);
    00064   static SbRotation identity(void);
    00065
    00066   void print(FILE * fp) const;
    00067
    00068 private:
    00069   SbVec4f quat;
    00070 };
    00071
    00072 COIN_DLL_API int operator ==(const SbRotation & q1, const SbRotation & q2);
    00073 COIN_DLL_API int operator !=(const SbRotation & q1, const SbRotation & q2);
    00074 COIN_DLL_API SbRotation operator *(const SbRotation & q1, const SbRotation & q2);
    00075
    00076 #endif // !COIN_SBROTATION_H