Home | History | Annotate | Download | only in detail
      1 ///////////////////////////////////////////////////////////////////////////////////
      2 /// OpenGL Mathematics (glm.g-truc.net)
      3 ///
      4 /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
      6 /// of this software and associated documentation files (the "Software"), to deal
      7 /// in the Software without restriction, including without limitation the rights
      8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 /// copies of the Software, and to permit persons to whom the Software is
     10 /// furnished to do so, subject to the following conditions:
     11 ///
     12 /// The above copyright notice and this permission notice shall be included in
     13 /// all copies or substantial portions of the Software.
     14 ///
     15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     21 /// THE SOFTWARE.
     22 ///
     23 /// @ref core
     24 /// @file glm/core/type_mat3x3.hpp
     25 /// @date 2005-01-27 / 2011-06-15
     26 /// @author Christophe Riccio
     27 ///////////////////////////////////////////////////////////////////////////////////
     28 
     29 #ifndef glm_core_type_mat3x3
     30 #define glm_core_type_mat3x3
     31 
     32 #include "../fwd.hpp"
     33 #include "type_vec3.hpp"
     34 #include "type_mat.hpp"
     35 #include <limits>
     36 
     37 namespace glm{
     38 namespace detail
     39 {
     40 	template <typename T, precision P>
     41 	struct tmat3x3
     42 	{
     43 		enum ctor{_null};
     44 		typedef T value_type;
     45 		typedef std::size_t size_type;
     46 		typedef tvec3<T, P> col_type;
     47 		typedef tvec3<T, P> row_type;
     48 		typedef tmat3x3<T, P> type;
     49 		typedef tmat3x3<T, P> transpose_type;
     50 
     51 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
     52 
     53 		template <typename U, precision Q>
     54 		friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
     55 		template <typename U, precision Q>
     56 		friend tvec3<U, Q> operator/(tvec3<U, Q> const & v, tmat3x3<U, Q> const & m);
     57 
     58 	private:
     59 		/// @cond DETAIL
     60 		col_type value[3];
     61 		/// @endcond
     62 
     63 	public:
     64 		// Constructors
     65 		GLM_FUNC_DECL tmat3x3();
     66 		GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> const & m);
     67 		template <precision Q>
     68 		GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
     69 
     70 		GLM_FUNC_DECL explicit tmat3x3(
     71 			ctor Null);
     72 		GLM_FUNC_DECL explicit tmat3x3(
     73 			T const & s);
     74 		GLM_FUNC_DECL tmat3x3(
     75 			T const & x0, T const & y0, T const & z0,
     76 			T const & x1, T const & y1, T const & z1,
     77 			T const & x2, T const & y2, T const & z2);
     78 		GLM_FUNC_DECL tmat3x3(
     79 			col_type const & v0,
     80 			col_type const & v1,
     81 			col_type const & v2);
     82 
     83 		//////////////////////////////////////
     84 		// Conversions
     85 		template<
     86 			typename X1, typename Y1, typename Z1,
     87 			typename X2, typename Y2, typename Z2,
     88 			typename X3, typename Y3, typename Z3>
     89 		GLM_FUNC_DECL tmat3x3(
     90 			X1 const & x1, Y1 const & y1, Z1 const & z1,
     91 			X2 const & x2, Y2 const & y2, Z2 const & z2,
     92 			X3 const & x3, Y3 const & y3, Z3 const & z3);
     93 
     94 		template <typename V1, typename V2, typename V3>
     95 		GLM_FUNC_DECL tmat3x3(
     96 			tvec3<V1, P> const & v1,
     97 			tvec3<V2, P> const & v2,
     98 			tvec3<V3, P> const & v3);
     99 
    100 		// Matrix conversions
    101 		template <typename U, precision Q>
    102 		GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
    103 
    104 		GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
    105 		GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);
    106 		GLM_FUNC_DECL explicit tmat3x3(tmat2x3<T, P> const & x);
    107 		GLM_FUNC_DECL explicit tmat3x3(tmat3x2<T, P> const & x);
    108 		GLM_FUNC_DECL explicit tmat3x3(tmat2x4<T, P> const & x);
    109 		GLM_FUNC_DECL explicit tmat3x3(tmat4x2<T, P> const & x);
    110 		GLM_FUNC_DECL explicit tmat3x3(tmat3x4<T, P> const & x);
    111 		GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
    112 
    113 		// Accesses
    114 		GLM_FUNC_DECL col_type & operator[](length_t i);
    115 		GLM_FUNC_DECL col_type const & operator[](length_t i) const;
    116 
    117 		// Unary updatable operators
    118 		GLM_FUNC_DECL tmat3x3<T, P>& operator=  (tmat3x3<T, P> const & m);
    119 		template <typename U>
    120 		GLM_FUNC_DECL tmat3x3<T, P>& operator=  (tmat3x3<U, P> const & m);
    121 		template <typename U>
    122 		GLM_FUNC_DECL tmat3x3<T, P>& operator+= (U s);
    123 		template <typename U>
    124 		GLM_FUNC_DECL tmat3x3<T, P>& operator+= (tmat3x3<U, P> const & m);
    125 		template <typename U>
    126 		GLM_FUNC_DECL tmat3x3<T, P>& operator-= (U s);
    127 		template <typename U>
    128 		GLM_FUNC_DECL tmat3x3<T, P>& operator-= (tmat3x3<U, P> const & m);
    129 		template <typename U>
    130 		GLM_FUNC_DECL tmat3x3<T, P>& operator*= (U s);
    131 		template <typename U>
    132 		GLM_FUNC_DECL tmat3x3<T, P>& operator*= (tmat3x3<U, P> const & m);
    133 		template <typename U>
    134 		GLM_FUNC_DECL tmat3x3<T, P>& operator/= (U s);
    135 		template <typename U>
    136 		GLM_FUNC_DECL tmat3x3<T, P>& operator/= (tmat3x3<U, P> const & m);
    137 
    138 		//////////////////////////////////////
    139 		// Increment and decrement operators
    140 
    141 		GLM_FUNC_DECL tmat3x3<T, P> & operator++ ();
    142 		GLM_FUNC_DECL tmat3x3<T, P> & operator-- ();
    143 		GLM_FUNC_DECL tmat3x3<T, P> operator++(int);
    144 		GLM_FUNC_DECL tmat3x3<T, P> operator--(int);
    145 	};
    146 
    147 	template <typename T, precision P>
    148 	GLM_FUNC_DECL tmat3x3<T, P> compute_inverse_mat3(tmat3x3<T, P> const & m);
    149 
    150 	// Binary operators
    151 	template <typename T, precision P>
    152 	GLM_FUNC_DECL tmat3x3<T, P> operator+ (
    153 		tmat3x3<T, P> const & m,
    154 		T const & s);
    155 
    156 	template <typename T, precision P>
    157 	GLM_FUNC_DECL tmat3x3<T, P> operator+ (
    158 		T const & s,
    159 		tmat3x3<T, P> const & m);
    160 
    161 	template <typename T, precision P>
    162 	GLM_FUNC_DECL tmat3x3<T, P> operator+ (
    163 		tmat3x3<T, P> const & m1,
    164 		tmat3x3<T, P> const & m2);
    165 
    166 	template <typename T, precision P>
    167 	GLM_FUNC_DECL tmat3x3<T, P> operator- (
    168 		tmat3x3<T, P> const & m,
    169 		T const & s);
    170 
    171 	template <typename T, precision P>
    172 	GLM_FUNC_DECL tmat3x3<T, P> operator- (
    173 		T const & s,
    174 		tmat3x3<T, P> const & m);
    175 
    176 	template <typename T, precision P>
    177 	GLM_FUNC_DECL tmat3x3<T, P> operator- (
    178 		tmat3x3<T, P> const & m1,
    179 		tmat3x3<T, P> const & m2);
    180 
    181 	template <typename T, precision P>
    182 	GLM_FUNC_DECL tmat3x3<T, P> operator* (
    183 		tmat3x3<T, P> const & m,
    184 		T const & s);
    185 
    186 	template <typename T, precision P>
    187 	GLM_FUNC_DECL tmat3x3<T, P> operator* (
    188 		T const & s,
    189 		tmat3x3<T, P> const & m);
    190 
    191 	template <typename T, precision P>
    192 	GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator* (
    193 		tmat3x3<T, P> const & m,
    194 		typename tmat3x3<T, P>::row_type const & v);
    195 
    196 	template <typename T, precision P>
    197 	GLM_FUNC_DECL typename tmat3x3<T, P>::row_type operator* (
    198 		typename tmat3x3<T, P>::col_type const & v,
    199 		tmat3x3<T, P> const & m);
    200 
    201 	template <typename T, precision P>
    202 	GLM_FUNC_DECL tmat3x3<T, P> operator* (
    203 		tmat3x3<T, P> const & m1,
    204 		tmat3x3<T, P> const & m2);
    205 
    206 	template <typename T, precision P>
    207 	GLM_FUNC_DECL tmat2x3<T, P> operator* (
    208 		tmat3x3<T, P> const & m1,
    209 		tmat2x3<T, P> const & m2);
    210 
    211 	template <typename T, precision P>
    212 	GLM_FUNC_DECL tmat4x3<T, P> operator* (
    213 		tmat3x3<T, P> const & m1,
    214 		tmat4x3<T, P> const & m2);
    215 
    216 	template <typename T, precision P>
    217 	GLM_FUNC_DECL tmat3x3<T, P> operator/ (
    218 		tmat3x3<T, P> const & m,
    219 		T const & s);
    220 
    221 	template <typename T, precision P>
    222 	GLM_FUNC_DECL tmat3x3<T, P> operator/ (
    223 		T const & s,
    224 		tmat3x3<T, P> const & m);
    225 
    226 	template <typename T, precision P>
    227 	GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator/ (
    228 		tmat3x3<T, P> const & m,
    229 		typename tmat3x3<T, P>::row_type const & v);
    230 
    231 	template <typename T, precision P>
    232 	GLM_FUNC_DECL typename tmat3x3<T, P>::row_type operator/ (
    233 		typename tmat3x3<T, P>::col_type const & v,
    234 		tmat3x3<T, P> const & m);
    235 
    236 	template <typename T, precision P>
    237 	GLM_FUNC_DECL tmat3x3<T, P> operator/ (
    238 		tmat3x3<T, P> const & m1,
    239 		tmat3x3<T, P> const & m2);
    240 
    241 	// Unary constant operators
    242 	template <typename T, precision P>
    243 	GLM_FUNC_DECL tmat3x3<T, P> const operator-(
    244 		tmat3x3<T, P> const & m);
    245 
    246 }//namespace detail
    247 }//namespace glm
    248 
    249 #ifndef GLM_EXTERNAL_TEMPLATE
    250 #include "type_mat3x3.inl"
    251 #endif
    252 
    253 #endif //glm_core_type_mat3x3
    254