Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Matrix22.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2011, The Cinder Project: http://libcinder.org All rights reserved.
3  This code is intended for use with the Cinder C++ library: http://libcinder.org
4 
5  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
6  the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and
9  the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
11  the following disclaimer in the documentation and/or other materials provided with the distribution.
12 
13  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
14  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
15  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
16  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
17  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20  POSSIBILITY OF SUCH DAMAGE.
21 */
22 
23 
24 #pragma once
25 
26 #include "cinder/Cinder.h"
27 #include "cinder/CinderMath.h"
28 #include "cinder/Vector.h"
29 
30 #include <iomanip>
31 
32 namespace cinder {
33 
35 // Matrix22
36 template< typename T >
37 class Matrix22
38 {
39 public:
40  typedef T TYPE;
41  typedef T value_type;
42  //
43  static const size_t DIM = 2;
44  static const size_t DIM_SQ = DIM*DIM;
45  static const size_t MEM_LEN = sizeof(T)*DIM_SQ;
46 
47  //
48  // This class is OpenGL friendly and stores the m as how OpenGL would expect it.
49  // m[i,j]:
50  // | m[0,0] m[0,1] |
51  // | m[1,0] m[1,1] |
52  //
53  // m[idx]
54  // | m[0] m[2] |
55  // | m[1] m[3] |
56  //
57  union {
58  T m[4];
59  struct {
60  // This looks like it's transposed from the above, but it's really not.
61  // It just has to be written this way so it follows the right ordering
62  // in the memory layout as well as being mathematically correct.
63  T m00, m10;
64  T m01, m11;
65  };
66  // [Cols][Rows]
67  T mcols[2][2];
68  };
69 
70  Matrix22();
71 
72  Matrix22( T s );
73 
74  // OpenGL layout - unless srcIsRowMajor is true
75  Matrix22( const T *dt, bool srcIsRowMajor = false );
76 
77  // OpenGL layout: m[0]=d0, m[1]=d1, m[2]=d2, m[3]=d3 - unless srcIsRowMajor is true
78  Matrix22( T d0, T d1, T d2, T d3, bool srcIsRowMajor = false );
79 
80  // Creates matrix with column vectors vx and vy
81  Matrix22( const Vec2<T> &vx, const Vec2<T> &vy );
82 
83  template< typename FromT >
84  Matrix22( const Matrix22<FromT>& src );
85 
86  Matrix22( const Matrix22<T>& src );
87 
88  operator T*() { return (T*)m; }
89  operator const T*() const { return (const T*)m; }
90 
91  Matrix22<T>& operator=( const Matrix22<T>& rhs );
92  Matrix22<T>& operator=( const T &rhs );
93 
94  template< typename FromT >
95  Matrix22<T>& operator=( const Matrix22<FromT>& rhs );
96 
97  bool equalCompare( const Matrix22<T>& rhs, T epsilon ) const;
98  bool operator==( const Matrix22<T> &rhs ) const { return equalCompare( rhs, (T)EPSILON ); }
99  bool operator!=( const Matrix22<T> &rhs ) const { return ! ( *this == rhs ); }
100 
101  Matrix22<T>& operator*=( const Matrix22<T> &rhs );
102  Matrix22<T>& operator+=( const Matrix22<T> &rhs );
103  Matrix22<T>& operator-=( const Matrix22<T> &rhs );
104 
105  Matrix22<T>& operator*=( T s );
106  Matrix22<T>& operator/=( T s );
107  Matrix22<T>& operator+=( T s );
108  Matrix22<T>& operator-=( T s );
109 
110  const Matrix22<T> operator*( const Matrix22<T> &rhs ) const;
111  const Matrix22<T> operator+( const Matrix22<T> &rhs ) const;
112  const Matrix22<T> operator-( const Matrix22<T> &rhs ) const;
113 
114  // post-multiplies column vector [rhs.x rhs.y]
115  const Vec2<T> operator*( const Vec2<T> &rhs ) const;
116 
117  const Matrix22<T> operator*( T rhs ) const;
118  const Matrix22<T> operator/( T rhs ) const;
119  const Matrix22<T> operator+( T rhs ) const;
120  const Matrix22<T> operator-( T rhs ) const;
121 
122  // Accessors
123  T& at( int row, int col );
124  const T& at( int row, int col ) const;
125 
126  // OpenGL layout - unless srcIsRowMajor is true
127  void set( const T *dt, bool srcIsRowMajor = false );
128  // OpenGL layout: m[0]=d0, m[1]=d1, m[2]=d2, m[3]=d3 - unless srcIsRowMajor is true
129  void set( T d0, T d1, T d2, T d3, bool srcIsRowMajor = false );
130 
131  Vec2<T> getColumn( int col ) const;
132  void setColumn( int col, const Vec2<T> &v );
133 
134  Vec2<T> getRow( int row ) const;
135  void setRow( int row, const Vec2<T> &v );
136 
137  void getColumns( Vec2<T> *c0, Vec2<T> *c1 ) const;
138  void setColumns( const Vec2<T> &c0, const Vec2<T> &c1 );
139 
140  void getRows( Vec2<T> *r0, Vec2<T> *r1 ) const;
141  void setRows( const Vec2<T> &r0, const Vec2<T> &r1 );
142 
143  void setToNull();
144  void setToIdentity();
145 
146  T determinant() const;
147  T trace() const;
148 
149  Matrix22<T> diagonal() const;
150 
153 
154  void transpose();
155  Matrix22<T> transposed() const;
156 
157  void invert (T epsilon = FLT_MIN ) { *this = inverted( epsilon ); }
158  Matrix22<T> inverted( T epsilon = FLT_MIN ) const;
159 
160  // pre-multiplies row vector v - no divide by w
161  Vec2<T> preMultiply( const Vec2<T> &v ) const;
162 
163  // post-multiplies column vector v - no divide by w
164  Vec2<T> postMultiply( const Vec2<T> &v ) const;
165 
166  // post-multiplies column vector [rhs.x rhs.y]
167  Vec2<T> transformVec( const Vec2<T> &v ) const { return postMultiply( v ); }
168 
169  // rotate by radians (conceptually, rotate is before 'this')
170  void rotate( T radians ) { Matrix22 rot = createRotation( radians ); Matrix22 mat = *this; *this = rot*mat; }
171 
172  // concatenate scale (conceptually, scale is before 'this')
173  void scale( T s ) { Matrix22 sc = createScale( s ); Matrix22 mat = *this; *this = sc*mat; }
174  void scale( const Vec2<T> &v ) { Matrix22 sc = createScale( v ); Matrix22 mat = *this; *this = sc*mat; }
175 
176  // transposes rotation sub-matrix and inverts translation
178 
179  // returns an identity matrix
180  static Matrix22<T> identity() { return Matrix22( 1, 0, 0, 1 ); }
181  // returns 1 filled matrix
182  static Matrix22<T> one() { return Matrix22( (T)1 ); }
183  // returns 0 filled matrix
184  static Matrix22<T> zero() { return Matrix22( (T)0 ); }
185 
186  // creates rotation matrix
187  static Matrix22<T> createRotation( T radians );
188 
189  // creates scale matrix
190  static Matrix22<T> createScale( T s );
191  static Matrix22<T> createScale( const Vec2<T> &v );
192 
193  friend std::ostream& operator<<( std::ostream& lhs, const Matrix22<T>& rhs ) {
194  for( int i = 0; i < 2; i++ ) {
195  lhs << "|\t";
196  for( int j = 0; j < 2; j++ ) {
197  lhs << rhs.at( i, j ) << "\t";
198  }
199  lhs << "|" << std::endl;
200  }
201 
202  return lhs;
203  }
204 
205 };
206 
207 template< typename T >
209 {
210  setToIdentity();
211 }
212 
213 template< typename T >
215 {
216  for( int i = 0; i < DIM_SQ; ++i ) {
217  m[i] = s;
218  }
219 }
220 
221 template< typename T >
222 Matrix22<T>::Matrix22( const T *dt, bool srcIsRowMajor )
223 {
224  set( dt, srcIsRowMajor );
225 }
226 
227 template< typename T >
228 Matrix22<T>::Matrix22( T d0, T d1, T d2, T d3, bool srcIsRowMajor )
229 {
230  set( d0, d1,
231  d2, d3, srcIsRowMajor );
232 }
233 
234 template< typename T >
235 Matrix22<T>::Matrix22( const Vec2<T> &vx, const Vec2<T> &vy )
236 {
237  m00 = vx.x; m01 = vy.x;
238  m10 = vx.y; m11 = vy.y;
239 }
240 
241 template< typename T >
242 template< typename FromT >
244 {
245  for( int i = 0; i < DIM_SQ; ++i ) {
246  m[i] = static_cast<T>( src.m[i] );
247  }
248 }
249 
250 template< typename T >
252 {
253  std::memcpy( m, src.m, MEM_LEN );
254 }
255 
256 template< typename T >
258 {
259  memcpy( m, rhs.m, MEM_LEN );
260  return *this;
261 }
262 
263 template< typename T >
265 {
266  for( int i = 0; i < DIM_SQ; ++i ) {
267  m[i] = rhs;
268  }
269  return *this;
270 }
271 
272 template< typename T >
273 template< typename FromT >
275 {
276  for( int i = 0; i < DIM_SQ; i++ ) {
277  m[i] = static_cast<T>(rhs.m[i]);
278  }
279  return *this;
280 }
281 
282 template< typename T >
283 bool Matrix22<T>::equalCompare( const Matrix22<T>& rhs, T epsilon ) const
284 {
285  for( int i = 0; i < DIM_SQ; ++i ) {
286  T diff = fabs( m[i] - rhs.m[i] );
287  if( diff >= epsilon )
288  return false;
289  }
290  return true;
291 }
292 
293 template< typename T >
295 {
296  Matrix22<T> mat;
297 
298  mat.m[0] = m[0]*rhs.m[0] + m[2]*rhs.m[1];
299  mat.m[1] = m[1]*rhs.m[0] + m[3]*rhs.m[1];
300 
301  mat.m[2] = m[0]*rhs.m[2] + m[2]*rhs.m[3];
302  mat.m[3] = m[1]*rhs.m[2] + m[3]*rhs.m[3];
303 
304  *this = mat;
305 
306  return *this;
307 }
308 
309 template< typename T >
311 {
312  for( int i = 0; i < DIM_SQ; ++i ) {
313  m[i] += rhs.m[i];
314  }
315  return *this;
316 }
317 
318 template< typename T >
320 {
321  for( int i = 0; i < DIM_SQ; ++i ) {
322  m[i] -= rhs.m[i];
323  }
324  return *this;
325 }
326 
327 template< typename T >
329 {
330  for( int i = 0; i < DIM_SQ; ++i ) {
331  m[i] *= s;
332  }
333  return *this;
334 }
335 
336 template< typename T >
338 {
339  T invS = (T)1/s;
340  for( int i = 0; i < DIM_SQ; ++i ) {
341  m[i] *= invS;
342  }
343  return *this;
344 }
345 
346 template< typename T >
348 {
349  for( int i = 0; i < DIM_SQ; ++i ) {
350  m[i] += s;
351  }
352  return *this;
353 }
354 
355 template< typename T >
357 {
358  for( int i = 0; i < DIM_SQ; ++i ) {
359  m[i] -= s;
360  }
361  return *this;
362 }
363 
364 template< typename T >
366 {
367  Matrix22<T> ret;
368 
369  ret.m[0] = m[0]*rhs.m[0] + m[2]*rhs.m[1];
370  ret.m[1] = m[1]*rhs.m[0] + m[3]*rhs.m[1];
371 
372  ret.m[2] = m[0]*rhs.m[2] + m[2]*rhs.m[3];
373  ret.m[3] = m[1]*rhs.m[2] + m[3]*rhs.m[3];
374 
375  return ret;
376 }
377 
378 template< typename T >
380 {
381  Matrix22<T> ret;
382  for( int i = 0; i < DIM_SQ; ++i ) {
383  ret.m[i] = m[i] + rhs.m[i];
384  }
385  return ret;
386 }
387 
388 template< typename T >
390 {
391  Matrix22<T> ret;
392  for( int i = 0; i < DIM_SQ; ++i ) {
393  ret.m[i] = m[i] - rhs.m[i];
394  }
395  return ret;
396 }
397 
398 template< typename T >
399 const Vec2<T> Matrix22<T>::operator*( const Vec2<T> &rhs ) const
400 {
401  return Vec2<T>(
402  m[0]*rhs.x + m[2]*rhs.y,
403  m[1]*rhs.x + m[3]*rhs.y
404  );
405 }
406 
407 
408 template< typename T >
410 {
411  Matrix22<T> ret;
412  for( int i = 0; i < DIM_SQ; ++i ) {
413  ret.m[i] = m[i]*rhs;
414  }
415  return ret;
416 }
417 
418 template< typename T >
420 {
421  Matrix22<T> ret;
422  T s = (T)1/rhs;
423  for( int i = 0; i < DIM_SQ; ++i ) {
424  ret.m[i] = m[i]*s;
425  }
426  return ret;
427 }
428 
429 template< typename T >
431 {
432  Matrix22<T> ret;
433  for( int i = 0; i < DIM_SQ; ++i ) {
434  ret.m[i] = m[i] + rhs;
435  }
436  return ret;
437 }
438 
439 template< typename T >
441 {
442  Matrix22<T> ret;
443  for( int i = 0; i < DIM_SQ; ++i ) {
444  ret.m[i] = m[i] - rhs;
445  }
446  return ret;
447 }
448 
449 template< typename T >
450 T& Matrix22<T>::at( int row, int col )
451 {
452  assert(row >= 0 && row < DIM);
453  assert(col >= 0 && col < DIM);
454  return m[col*DIM + row];
455 }
456 
457 template< typename T >
458 const T& Matrix22<T>::at( int row, int col ) const
459 {
460  assert(row >= 0 && row < DIM);
461  assert(col >= 0 && col < DIM);
462  return m[col*DIM + row];
463 }
464 
465 template< typename T >
466 void Matrix22<T>::set( const T *dt, bool srcIsRowMajor )
467 {
468  if( srcIsRowMajor ) {
469  m00 = dt[0]; m01 = dt[2];
470  m10 = dt[1]; m11 = dt[3];
471  }
472  else {
473  std::memcpy( m, dt, MEM_LEN );
474  }
475 }
476 
477 template< typename T >
478 void Matrix22<T>::set( T d0, T d1, T d2, T d3, bool srcIsRowMajor )
479 {
480  if( srcIsRowMajor ) {
481  m[0] = d0; m[2] = d1;
482  m[1] = d2; m[3] = d3;
483  }
484  else {
485  m[0] = d0; m[2] = d2;
486  m[1] = d1; m[3] = d3;
487  }
488 }
489 
490 template< typename T >
492 {
493  size_t i = col*DIM;
494  return Vec2<T>(
495  m[i + 0],
496  m[i + 1]
497  );
498 }
499 
500 template< typename T >
501 void Matrix22<T>::setColumn( int col, const Vec2<T> &v )
502 {
503  size_t i = col*DIM;
504  m[i + 0] = v.x;
505  m[i + 1] = v.y;
506 }
507 
508 template< typename T >
510 {
511  return Vec2<T>(
512  m[row + 0],
513  m[row + 2]
514  );
515 }
516 
517 template< typename T >
518 void Matrix22<T>::setRow( int row, const Vec2<T> &v )
519 {
520  m[row + 0] = v.x;
521  m[row + 2] = v.y;
522 }
523 
524 template< typename T >
526 {
527  *c0 = getColumn( 0 );
528  *c1 = getColumn( 1 );
529 }
530 
531 template< typename T >
532 void Matrix22<T>::setColumns( const Vec2<T> &c0, const Vec2<T> &c1 )
533 {
534  setColumn( 0, c0 );
535  setColumn( 1, c1 );
536 }
537 
538 template< typename T >
539 void Matrix22<T>::getRows( Vec2<T> *r0, Vec2<T> *r1 ) const
540 {
541  *r0 = getRow( 0 );
542  *r1 = getRow( 1 );
543 }
544 
545 template< typename T >
546 void Matrix22<T>::setRows( const Vec2<T> &r0, const Vec2<T> &r1 )
547 {
548  setRow( 0, r0 );
549  setRow( 1, r1 );
550 }
551 
552 template< typename T >
554 {
555  std::memset( m, 0, MEM_LEN );
556 }
557 
558 template< typename T >
560 {
561  m00 = 1; m01 = 0;
562  m10 = 0; m11 = 1;
563 }
564 
565 template< typename T >
567 {
568  T det = m[0]*m[3] - m[1]*m[2];
569  return det;
570 }
571 
572 template< typename T >
574 {
575  return m00 + m11;
576 }
577 
578 template< typename T >
580 {
581  Matrix22 ret;
582  ret.m00 = m00; ret.m01 = 0;
583  ret.m10 = 0; ret.m11 = m11;
584  return ret;
585 }
586 
587 template< typename T >
589 {
590  Matrix22 ret;
591  ret.m00 = m00; ret.m01 = 0;
592  ret.m10 = m10; ret.m11 = m11;
593  return ret;
594 }
595 
596 template< typename T >
598 {
599  Matrix22 ret;
600  ret.m00 = m00; ret.m01 = m01;
601  ret.m10 = 0; ret.m11 = m11;
602  return ret;
603 }
604 
605 template< typename T >
607 {
608  T t;
609  t = m01; m01 = m10; m10 = t;
610 }
611 
612 template< typename T >
614 {
615  return Matrix22<T>(
616  m[ 0], m[ 2],
617  m[ 1], m[ 3]
618  );
619 }
620 
621 template< typename T >
623 {
624  Matrix22<T> inv( (T)0 );
625 
626  T det = m[0]*m[3] - m[1]*m[2];
627 
628  if( fabs( det ) > epsilon ) {
629  T invDet = (T)1/det;
630  inv.m[0] = m[3]*invDet;
631  inv.m[1] = -m[1]*invDet;
632  inv.m[2] = -m[2]*invDet;
633  inv.m[3] = m[0]*invDet;
634  }
635 
636  return inv;
637 }
638 
639 template< typename T >
641 {
642  return Vec2<T>(
643  v.x*m00 + v.y*m10,
644  v.x*m01 + v.y*m11
645  );
646 }
647 
648 template< typename T >
650 {
651  return Vec2<T>(
652  m00*v.x + m01*v.y,
653  m10*v.x + m11*v.y
654  );
655 }
656 
657 template< typename T >
659 {
660  Matrix22<T> ret;
661 
662  // transpose rotation part
663  for( int i = 0; i < DIM; i++ ) {
664  for( int j = 0; j < DIM; j++ ) {
665  ret.at( j, i ) = at( i, j );
666  }
667  }
668 
669  return ret;
670 }
671 
672 template< typename T >
674 {
675  Matrix22<T> ret;
676  T ac = cos( radians );
677  T as = sin( radians );
678  ret.m00 = ac; ret.m01 = as;
679  ret.m10 = -as; ret.m11 = ac;
680  return ret;
681 }
682 
683 template< typename T >
685 {
686  Matrix22<T> ret;
687  ret.m00 = s; ret.m01 = 0;
688  ret.m10 = 0; ret.m11 = s;
689  return ret;
690 }
691 
692 template< typename T >
694 {
695  Matrix22<T> ret;
696  ret.m00 = v.x; ret.m01 = 0;
697  ret.m10 = 0; ret.m11 = v.y;
698  return ret;
699 }
700 
702 // Typedefs
705 
706 } // namespace cinder
Matrix22< T > upperTriangular() const
Definition: Matrix22.h:597
void set(const T *dt, bool srcIsRowMajor=false)
Definition: Matrix22.h:466
void setRows(const Vec2< T > &r0, const Vec2< T > &r1)
Definition: Matrix22.h:546
T m[4]
Definition: Matrix22.h:58
static Matrix22< T > one()
Definition: Matrix22.h:182
void setColumns(const Vec2< T > &c0, const Vec2< T > &c1)
Definition: Matrix22.h:532
void setColumn(int col, const Vec2< T > &v)
Definition: Matrix22.h:501
Matrix22< T > lowerTriangular() const
Definition: Matrix22.h:588
static Matrix22< T > zero()
Definition: Matrix22.h:184
void rotate(T radians)
Definition: Matrix22.h:170
T trace() const
Definition: Matrix22.h:573
T m01
Definition: Matrix22.h:64
#define EPSILON
Definition: CinderMath.h:125
Matrix22< double > Matrix22d
Definition: Matrix22.h:704
static Matrix22< T > identity()
Definition: Matrix22.h:180
T determinant() const
Definition: Matrix22.h:566
void setToNull()
Definition: Matrix22.h:553
GLuint src
Definition: GLee.h:10873
const Matrix22< T > operator*(const Matrix22< T > &rhs) const
Definition: Matrix22.h:365
Matrix22< T > & operator=(const Matrix22< T > &rhs)
Definition: Matrix22.h:257
void transpose()
Definition: Matrix22.h:606
T x
Definition: Vector.h:71
Matrix22< T > inverted(T epsilon=FLT_MIN) const
Definition: Matrix22.h:622
static const size_t DIM
Definition: Matrix22.h:43
T mcols[2][2]
Definition: Matrix22.h:67
void setToIdentity()
Definition: Matrix22.h:559
void scale(const Vec2< T > &v)
Definition: Matrix22.h:174
Definition: Vector.h:68
T m10
Definition: Matrix22.h:63
GLenum GLenum GLvoid * row
Definition: GLee.h:1089
bool operator!=(const Matrix22< T > &rhs) const
Definition: Matrix22.h:99
void scale(T s)
Definition: Matrix22.h:173
bool equalCompare(const Matrix22< T > &rhs, T epsilon) const
Definition: Matrix22.h:283
Vec2< T > getColumn(int col) const
Definition: Matrix22.h:491
void invert(T epsilon=FLT_MIN)
Definition: Matrix22.h:157
void getRows(Vec2< T > *r0, Vec2< T > *r1) const
Definition: Matrix22.h:539
Matrix22< T > invertTransform() const
Definition: Matrix22.h:658
Vec2< T > transformVec(const Vec2< T > &v) const
Definition: Matrix22.h:167
static const size_t DIM_SQ
Definition: Matrix22.h:44
bool operator==(const Matrix22< T > &rhs) const
Definition: Matrix22.h:98
Vec2< T > postMultiply(const Vec2< T > &v) const
Definition: Matrix22.h:649
T value_type
Definition: Matrix22.h:41
Matrix22< T > & operator*=(const Matrix22< T > &rhs)
Definition: Matrix22.h:294
T & at(int row, int col)
Definition: Matrix22.h:450
const GLdouble * v
Definition: GLee.h:1384
static const size_t MEM_LEN
Definition: Matrix22.h:45
T y
Definition: Vector.h:71
Matrix22< T > & operator/=(T s)
Definition: Matrix22.h:337
const Matrix22< T > operator/(T rhs) const
Definition: Matrix22.h:419
T m00
Definition: Matrix22.h:63
Matrix22< T > & operator+=(const Matrix22< T > &rhs)
Definition: Matrix22.h:310
Definition: Matrix22.h:37
void setRow(int row, const Vec2< T > &v)
Definition: Matrix22.h:518
void getColumns(Vec2< T > *c0, Vec2< T > *c1) const
Definition: Matrix22.h:525
Matrix22< T > & operator-=(const Matrix22< T > &rhs)
Definition: Matrix22.h:319
Matrix22()
Definition: Matrix22.h:208
T m11
Definition: Matrix22.h:64
Vec2< T > preMultiply(const Vec2< T > &v) const
Definition: Matrix22.h:640
const Matrix22< T > operator-(const Matrix22< T > &rhs) const
Definition: Matrix22.h:389
const GLfloat * m
Definition: GLee.h:13493
Matrix22< float > Matrix22f
Definition: Matrix22.h:703
Matrix22< T > diagonal() const
Definition: Matrix22.h:579
static Matrix22< T > createScale(T s)
Definition: Matrix22.h:684
GLdouble GLdouble t
Definition: GLee.h:1426
static Matrix22< T > createRotation(T radians)
Definition: Matrix22.h:673
GLdouble s
Definition: GLee.h:1378
T TYPE
Definition: Matrix22.h:40
const Matrix22< T > operator+(const Matrix22< T > &rhs) const
Definition: Matrix22.h:379
Matrix22< T > transposed() const
Definition: Matrix22.h:613
Vec2< T > getRow(int row) const
Definition: Matrix22.h:509