Coin: SbDPRotation.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SbDPRotation.h
1#ifndef COIN_SBDPROTATION_H
2#define COIN_SBDPROTATION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <cstdio>
37#include <Inventor/SbVec4d.h>
38
39class SbDPMatrix;
40class SbVec3d;
41
42 class COIN_DLL_API SbDPRotation {
43public:
44 SbDPRotation(void);
45 SbDPRotation(const SbVec3d & axis, const double radians);
46 SbDPRotation(const double q[4]);
47 SbDPRotation(const double q0, const double q1, const double q2, const double q3);
48 SbDPRotation(const SbDPMatrix & m);
49 SbDPRotation(const SbVec3d & rotateFrom, const SbVec3d & rotateTo);
50 const double * getValue(void) const;
51 void getValue(double & q0, double & q1, double & q2, double & q3) const;
52 SbDPRotation & setValue(const double q0, const double q1,
53 const double q2, const double q3);
54 void getValue(SbVec3d & axis, double & radians) const;
55 void getValue(SbDPMatrix & matrix) const;
56 SbDPRotation & invert(void);
57 SbDPRotation inverse(void) const;
58 SbDPRotation & setValue(const double q[4]);
59 SbDPRotation & setValue(const SbDPMatrix & m);
60 SbDPRotation & setValue(const SbVec3d & axis, const double radians);
61 SbDPRotation & setValue(const SbVec3d & rotateFrom, const SbVec3d & rotateTo);
62 SbBool equals(const SbDPRotation & r, double tolerance) const;
63 void multVec(const SbVec3d & src, SbVec3d & dst) const;
64
65 void scaleAngle(const double scaleFactor);
66 static SbDPRotation slerp(const SbDPRotation & rot0, const SbDPRotation & rot1,
67 double t);
68 static SbDPRotation identity(void);
69
70 void print(FILE * fp) const;
71
72 SbDPRotation & operator*=(const SbDPRotation & q);
73 SbDPRotation & operator*=(const double s);
74 friend COIN_DLL_API int operator==(const SbDPRotation & q1, const SbDPRotation & q2);
75 friend COIN_DLL_API int operator!=(const SbDPRotation & q1, const SbDPRotation & q2);
76 friend COIN_DLL_API SbDPRotation operator *(const SbDPRotation & q1, const SbDPRotation & q2);
77private:
78 SbVec4d quat;
79};
80
81typedef SbDPRotation SbRotationd;
82
83
84COIN_DLL_API int operator ==(const SbDPRotation & q1, const SbDPRotation & q2);
85COIN_DLL_API int operator !=(const SbDPRotation & q1, const SbDPRotation & q2);
86COIN_DLL_API SbDPRotation operator *(const SbDPRotation & q1, const SbDPRotation & q2);
87
88#endif // !COIN_SBDPROTATION_H
SbDPMatrix
The SbDPMatrix class is a 4x4 dimensional representation of a double-precision matrix.
Definition SbDPMatrix.h:47
SbDPRotation
The SbDPRotation class represents a rotation in 3D space using double precision data.
Definition SbDPRotation.h:42
SbDPRotation::slerp
static SbDPRotation slerp(const SbDPRotation &rot0, const SbDPRotation &rot1, double t)
Definition SbDPRotation.cpp:581
SbDPRotation::operator*=
SbDPRotation & operator*=(const SbDPRotation &q)
Definition SbDPRotation.cpp:462
SbDPRotation::inverse
SbDPRotation inverse(void) const
Definition SbDPRotation.cpp:273
SbDPRotation::invert
SbDPRotation & invert(void)
Definition SbDPRotation.cpp:247
SbDPRotation::scaleAngle
void scaleAngle(const double scaleFactor)
Definition SbDPRotation.cpp:559
SbDPRotation::multVec
void multVec(const SbVec3d &src, SbVec3d &dst) const
Definition SbDPRotation.cpp:545
SbDPRotation::operator==
friend int operator==(const SbDPRotation &q1, const SbDPRotation &q2)
Definition SbDPRotation.cpp:497
SbDPRotation::SbDPRotation
SbDPRotation(void)
Definition SbDPRotation.cpp:64
SbDPRotation::setValue
SbDPRotation & setValue(const double q0, const double q1, const double q2, const double q3)
Definition SbDPRotation.cpp:161
SbDPRotation::identity
static SbDPRotation identity(void)
Definition SbDPRotation.cpp:626
SbDPRotation::print
void print(FILE *fp) const
Definition SbDPRotation.cpp:636
SbDPRotation::operator!=
friend int operator!=(const SbDPRotation &q1, const SbDPRotation &q2)
Definition SbDPRotation.cpp:510
SbDPRotation::getValue
const double * getValue(void) const
Definition SbDPRotation.cpp:136
SbDPRotation::equals
SbBool equals(const SbDPRotation &r, double tolerance) const
Definition SbDPRotation.cpp:520
SbVec3d
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.
Definition SbVec3d.h:50
SbVec4d
The SbVec4d class is a 4 dimensional vector with double precision floating point coordinates.
Definition SbVec4d.h:49