00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef COIN_SBROTATION_H
00021
#define COIN_SBROTATION_H
00022
00023
#include <stdio.h>
00024
#include <Inventor/SbVec4f.h>
00025
00026
class SbMatrix;
00027
class SbVec3f;
00028
00029 class COIN_DLL_API SbRotation {
00030
public:
00031 SbRotation(
void);
00032 SbRotation(
const SbVec3f & axis,
const float radians);
00033 SbRotation(
const float q[4]);
00034 SbRotation(
const float q0,
const float q1,
const float q2,
const float q3);
00035 SbRotation(
const SbMatrix & m);
00036 SbRotation(
const SbVec3f & rotateFrom,
const SbVec3f & rotateTo);
00037
const float * getValue(
void)
const;
00038
void getValue(
float & q0,
float & q1,
float & q2,
float & q3)
const;
00039 SbRotation & setValue(
const float q0,
const float q1,
00040
const float q2,
const float q3);
00041
void getValue(
SbVec3f & axis,
float & radians)
const;
00042
void getValue(
SbMatrix & matrix)
const;
00043 SbRotation & invert(
void);
00044 SbRotation inverse(
void)
const;
00045 SbRotation & setValue(
const float q[4]);
00046 SbRotation & setValue(
const SbMatrix & m);
00047 SbRotation & setValue(
const SbVec3f & axis,
const float radians);
00048 SbRotation & setValue(
const SbVec3f & rotateFrom,
const SbVec3f & rotateTo);
00049 SbRotation & operator*=(
const SbRotation & q);
00050 SbRotation & operator*=(
const float s);
00051
friend COIN_DLL_API
int operator==(
const SbRotation & q1,
const SbRotation & q2);
00052
friend COIN_DLL_API
int operator!=(
const SbRotation & q1,
const SbRotation & q2);
00053 SbBool equals(
const SbRotation & r,
const float tolerance)
const;
00054
friend COIN_DLL_API SbRotation operator *(
const SbRotation & q1,
const SbRotation & q2);
00055
void multVec(
const SbVec3f & src,
SbVec3f & dst)
const;
00056
00057
void scaleAngle(
const float scaleFactor);
00058
static SbRotation slerp(
const SbRotation & rot0,
const SbRotation & rot1,
00059
float t);
00060
static SbRotation identity(
void);
00061
00062
void print(FILE * fp)
const;
00063
00064
private:
00065
SbVec4f quat;
00066 };
00067
00068 COIN_DLL_API
int operator ==(
const SbRotation & q1,
const SbRotation & q2);
00069 COIN_DLL_API
int operator !=(
const SbRotation & q1,
const SbRotation & q2);
00070 COIN_DLL_API SbRotation operator *(
const SbRotation & q1,
const SbRotation & q2);
00071
00072
#endif // !COIN_SBROTATION_H