Path Tracer
quaternion.h
Go to the documentation of this file.
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
4 
5 Copyright (c) 2006-2020, assimp team
6 
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the
12 following conditions are met:
13 
14 * Redistributions of source code must retain the above
15  copyright notice, this list of conditions and the
16  following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19  copyright notice, this list of conditions and the
20  following disclaimer in the documentation and/or other
21  materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24  contributors may be used to endorse or promote products
25  derived from this software without specific prior
26  written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 
40 ----------------------------------------------------------------------
41 */
42 
46 #pragma once
47 #ifndef AI_QUATERNION_H_INC
48 #define AI_QUATERNION_H_INC
49 
50 #ifdef __cplusplus
51 
52 #ifdef __GNUC__
53 # pragma GCC system_header
54 #endif
55 
56 #include <assimp/defs.h>
57 
58 template <typename TReal> class aiVector3t;
59 template <typename TReal> class aiMatrix3x3t;
60 
61 // ---------------------------------------------------------------------------
63 template <typename TReal>
64 class aiQuaterniont
65 {
66 public:
67  aiQuaterniont() AI_NO_EXCEPT : w(1.0), x(), y(), z() {}
68  aiQuaterniont(TReal pw, TReal px, TReal py, TReal pz)
69  : w(pw), x(px), y(py), z(pz) {}
70 
72  explicit aiQuaterniont( const aiMatrix3x3t<TReal>& pRotMatrix);
73 
75  aiQuaterniont( TReal rotx, TReal roty, TReal rotz);
76 
78  aiQuaterniont( aiVector3t<TReal> axis, TReal angle);
79 
81  explicit aiQuaterniont( aiVector3t<TReal> normalized);
82 
84  aiMatrix3x3t<TReal> GetMatrix() const;
85 
86 public:
87 
88  bool operator== (const aiQuaterniont& o) const;
89  bool operator!= (const aiQuaterniont& o) const;
90 
91  bool Equal(const aiQuaterniont& o, TReal epsilon = 1e-6) const;
92 
93 public:
94 
96  aiQuaterniont& Normalize();
97 
99  aiQuaterniont& Conjugate ();
100 
102  aiVector3t<TReal> Rotate (const aiVector3t<TReal>& in) const;
103 
105  aiQuaterniont operator* (const aiQuaterniont& two) const;
106 
107 public:
108 
115  static void Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart,
116  const aiQuaterniont& pEnd, TReal pFactor);
117 
118 public:
119 
121  TReal w, x, y, z;
122 } ;
123 
124 typedef aiQuaterniont<ai_real> aiQuaternion;
125 
126 #else
127 
128 struct aiQuaternion {
129  ai_real w, x, y, z;
130 };
131 
132 #endif
133 
134 #endif // AI_QUATERNION_H_INC
aiQuaternion
Definition: quaternion.h:128
defs.h
Assimp build configuration setup. See the notes in the comment blocks to find out how to customize yo...