CMSC23700 Common Code Library
Support code for CS23700 programming projects
cs237-mat3x2.hxx
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 2015 John Reppy (http://cs.uchicago.edu/~jhr)
10  * All rights reserved.
11  */
12 
13 #ifndef _CS237_MAT3X2_HXX_
14 #define _CS237_MAT3X2_HXX_
15 
16 #ifndef _CS237_HXX_
17 #error "c237-mat3x2.hxx should not be included directly"
18 #endif
19 
20 namespace cs237 {
21 
22  namespace __detail {
23 
25  template <typename T>
26  struct mat3x2 {
27  vec2<T> cv[3]; // column vectors
28 
30  mat3x2 () {}
32  mat3x2 (mat3x2 const &m);
34  explicit mat3x2 (
35  T m00, T m10, // first column
36  T m01, T m11, // second column
37  T m02, T m12); // third column
39  explicit mat3x2 (vec2<T> const &c0, vec2<T> const &c1, vec2<T> const &c2);
41  explicit mat3x2 (mat3x3<T> const &mm);
42 
45  vec2<T> & operator[] (unsigned int const &i);
46  vec2<T> const & operator[] (unsigned int const &i) const;
48 
49  mat3x2 & operator= (mat3x2 const &mm);
50 
51  mat3x2 & operator+= (T const &s);
52  mat3x2 & operator+= (mat3x2 const &v);
53 
54  mat3x2 & operator-= (T const &s);
55  mat3x2 & operator-= (mat3x2 const &v);
56 
58  mat3x2 & operator*= (T const &s);
59 
61  mat2x3<T> transpose() const;
62  };
63 
67  template <typename T>
68  std::ostream& operator<< (std::ostream& s, mat3x2<T> const &m);
69 
70  } /* _namespace __detail */
71 
76 
77 } /* namespace cs237 */
78 
79 #endif /* !_CS237_MAT3X2_HXX_ */
__detail::mat3x2< double > mat3x2d
Double-precision 3x2 matrices.
Definition: cs237-mat3x2.hxx:75
mat3x2 & operator*=(T const &s)
scale the elements of the matrix
Definition: cs237-mat3x2.inl:118
mat3x2()
create an uninitialized matrix
Definition: cs237-mat3x2.hxx:30
mat3x2 & operator+=(T const &s)
Definition: cs237-mat3x2.inl:80
mat3x2 & operator=(mat3x2 const &mm)
Definition: cs237-mat3x2.inl:71
mat2x3< T > transpose() const
return the transpose of this matrix
Definition: cs237-mat3x2.inl:128
vec2< T > cv[3]
Definition: cs237-mat3x2.hxx:27
mat3x2 & operator-=(T const &s)
Definition: cs237-mat3x2.inl:99
template class for 2x3 matrices
Definition: cs237-mat2x3.hxx:26
template class for 3x3 matrices
Definition: cs237-mat3x3.hxx:26
Definition: cs237-aabb.hxx:18
vec2< T > & operator[](unsigned int const &i)
return the i'th column vector
Definition: cs237-mat3x2.inl:57
template class for two-element vectors
Definition: cs237-types.hxx:25
template class for 3x2 matrices
Definition: cs237-mat3x2.hxx:26
__detail::mat3x2< float > mat3x2f
Single-precision 3x2 matrices.
Definition: cs237-mat3x2.hxx:73