CMSC23700 Common Code Library
Support code for CS23700 programming projects
cs237-mat2x3.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_MAT2X3_HXX_
14 #define _CS237_MAT2X3_HXX_
15 
16 #ifndef _CS237_HXX_
17 #error "c237-mat2x3.hxx should not be included directly"
18 #endif
19 
20 namespace cs237 {
21 
22  namespace __detail {
23 
25  template <typename T>
26  struct mat2x3 {
27  vec3<T> cv[2]; // column vectors
28 
30  mat2x3 () {}
32  mat2x3 (mat2x3 const &m);
34  explicit mat2x3 (
35  T m00, T m10, T m20, // first column
36  T m01, T m11, T m21); // second column
38  explicit mat2x3 (vec3<T> const &c0, vec3<T> const &c1);
40  explicit mat2x3 (mat3x3<T> const &mm);
41 
44  vec3<T> & operator[] (unsigned int const &i);
45  vec3<T> const & operator[] (unsigned int const &i) const;
47 
48  mat2x3 & operator= (mat2x3 const &mm);
49 
50  mat2x3 & operator+= (T const &s);
51  mat2x3 & operator+= (mat2x3 const &v);
52 
53  mat2x3 & operator-= (T const &s);
54  mat2x3 & operator-= (mat2x3 const &v);
55 
56  mat2x3 & operator*= (T const &s);
57 
59  mat3x2<T> transpose() const;
60  };
61 
65  template <typename T>
66  std::ostream& operator<< (std::ostream& s, mat2x3<T> const &m);
67 
68  } /* _namespace __detail */
69 
74 
75 } /* namespace cs237 */
76 
77 #endif /* !_CS237_MAT2X3_HXX_ */
mat2x3 & operator*=(T const &s)
Definition: cs237-mat2x3.inl:112
mat2x3 & operator-=(T const &s)
Definition: cs237-mat2x3.inl:95
mat3x2< T > transpose() const
return the transpose of this matrix
Definition: cs237-mat2x3.inl:121
template class for 2x3 matrices
Definition: cs237-mat2x3.hxx:26
template class for 3x3 matrices
Definition: cs237-mat3x3.hxx:26
mat2x3()
create an uninitialized matrix
Definition: cs237-mat2x3.hxx:30
__detail::mat2x3< double > mat2x3d
Double-precision 2x3 matrices.
Definition: cs237-mat2x3.hxx:73
vec3< T > cv[2]
Definition: cs237-mat2x3.hxx:27
Definition: cs237-aabb.hxx:18
template class for three-element vectors
Definition: cs237-types.hxx:26
__detail::mat2x3< float > mat2x3f
Single-precision 2x3 matrices.
Definition: cs237-mat2x3.hxx:71
mat2x3 & operator+=(T const &s)
Definition: cs237-mat2x3.inl:78
vec3< T > & operator[](unsigned int const &i)
return the i'th column vector
Definition: cs237-mat2x3.inl:56
mat2x3 & operator=(mat2x3 const &mm)
Definition: cs237-mat2x3.inl:70
template class for 3x2 matrices
Definition: cs237-mat3x2.hxx:26