Path Tracer
matrix3x3.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2020, assimp team
7 
8 
9 
10 All rights reserved.
11 
12 Redistribution and use of this software in source and binary forms,
13 with or without modification, are permitted provided that the following
14 conditions are met:
15 
16 * Redistributions of source code must retain the above
17  copyright notice, this list of conditions and the
18  following disclaimer.
19 
20 * Redistributions in binary form must reproduce the above
21  copyright notice, this list of conditions and the
22  following disclaimer in the documentation and/or other
23  materials provided with the distribution.
24 
25 * Neither the name of the assimp team, nor the names of its
26  contributors may be used to endorse or promote products
27  derived from this software without specific prior
28  written permission of the assimp team.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ---------------------------------------------------------------------------
42 */
43 
47 #pragma once
48 #ifndef AI_MATRIX3X3_H_INC
49 #define AI_MATRIX3X3_H_INC
50 
51 #ifdef __GNUC__
52 # pragma GCC system_header
53 #endif
54 
55 #include <assimp/defs.h>
56 
57 #ifdef __cplusplus
58 
59 template <typename T> class aiMatrix4x4t;
60 template <typename T> class aiVector2t;
61 template <typename T> class aiVector3t;
62 
63 // ---------------------------------------------------------------------------
72 template <typename TReal>
73 class aiMatrix3x3t {
74 public:
75  aiMatrix3x3t() AI_NO_EXCEPT :
76  a1(static_cast<TReal>(1.0f)), a2(), a3(),
77  b1(), b2(static_cast<TReal>(1.0f)), b3(),
78  c1(), c2(), c3(static_cast<TReal>(1.0f)) {}
79 
80  aiMatrix3x3t ( TReal _a1, TReal _a2, TReal _a3,
81  TReal _b1, TReal _b2, TReal _b3,
82  TReal _c1, TReal _c2, TReal _c3) :
83  a1(_a1), a2(_a2), a3(_a3),
84  b1(_b1), b2(_b2), b3(_b3),
85  c1(_c1), c2(_c2), c3(_c3)
86  {}
87 
88  // matrix multiplication.
89  aiMatrix3x3t& operator *= (const aiMatrix3x3t& m);
90  aiMatrix3x3t operator * (const aiMatrix3x3t& m) const;
91 
92  // array access operators
93  TReal* operator[] (unsigned int p_iIndex);
94  const TReal* operator[] (unsigned int p_iIndex) const;
95 
96  // comparison operators
97  bool operator== (const aiMatrix3x3t<TReal>& m) const;
98  bool operator!= (const aiMatrix3x3t<TReal>& m) const;
99 
100  bool Equal(const aiMatrix3x3t<TReal>& m, TReal epsilon = 1e-6) const;
101 
102  template <typename TOther>
103  operator aiMatrix3x3t<TOther> () const;
104 
105  // -------------------------------------------------------------------
109  explicit aiMatrix3x3t( const aiMatrix4x4t<TReal>& pMatrix);
110 
111  // -------------------------------------------------------------------
114  aiMatrix3x3t& Transpose();
115 
116  // -------------------------------------------------------------------
121  aiMatrix3x3t& Inverse();
122  TReal Determinant() const;
123 
124  // -------------------------------------------------------------------
130  static aiMatrix3x3t& RotationZ(TReal a, aiMatrix3x3t& out);
131 
132  // -------------------------------------------------------------------
140  static aiMatrix3x3t& Rotation( TReal a, const aiVector3t<TReal>& axis, aiMatrix3x3t& out);
141 
142  // -------------------------------------------------------------------
148  static aiMatrix3x3t& Translation( const aiVector2t<TReal>& v, aiMatrix3x3t& out);
149 
150  // -------------------------------------------------------------------
159  static aiMatrix3x3t& FromToMatrix(const aiVector3t<TReal>& from,
160  const aiVector3t<TReal>& to, aiMatrix3x3t& out);
161 
162 public:
163  TReal a1, a2, a3;
164  TReal b1, b2, b3;
165  TReal c1, c2, c3;
166 };
167 
168 typedef aiMatrix3x3t<ai_real> aiMatrix3x3;
169 
170 #else
171 
172 struct aiMatrix3x3 {
173  ai_real a1, a2, a3;
174  ai_real b1, b2, b3;
175  ai_real c1, c2, c3;
176 };
177 
178 #endif // __cplusplus
179 
180 #endif // AI_MATRIX3X3_H_INC
aiMatrix3x3
Definition: matrix3x3.h:172
defs.h
Assimp build configuration setup. See the notes in the comment blocks to find out how to customize yo...