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