My Project
 All Classes Files Functions Variables Enumerations Pages
matrix34.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Copyright 2009 Tim Day */
3 /* */
4 /* This file is part of Fracplanet */
5 /* */
6 /* Fracplanet is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* Fracplanet is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18 /**************************************************************************/
19 
24 #ifndef _matrix34_h_
25 #define _matrix34_h_
26 
27 #include "matrix33.h"
28 #include "xyz.h"
29 
31 
34 class Matrix34
35 {
36  public:
37 
40 
44 
47  {}
48 
50  Matrix34(const Matrix33& r,const XYZ& t)
51  :rotate(r)
52  ,translate(t)
53  {}
54 
56  Matrix34(const XYZ& rx,const XYZ& ry,const XYZ& rz,const XYZ& tr)
57  :rotate(rx,ry,rz)
58  ,translate(tr)
59  {}
60 
63  {}
64 
65  void assign(const Matrix34& m)
66  {
67  rotate=m.rotate;
69  }
70 };
71 
72 inline const XYZ operator*(const Matrix34& m,const XYZ& v)
73 {
74  return m.rotate*v+m.translate;
75 }
76 
77 inline const Matrix34 operator*(const Matrix34& a,const Matrix34& b)
78 {
79  return Matrix34
80  (
81  a.rotate*b.rotate,
83  );
84 }
85 
86 class Matrix34Identity : public Matrix34
87 {
88  public:
90  :Matrix34(Matrix33Identity(),XYZ(0.0f,0.0f,0.0f))
91  {}
92 };
93 
95 {
96  public:
97  Matrix34Translate(const XYZ& t)
99  {}
100 };
101 
103 {
104  public:
106  Matrix34RotateAboutAxisThrough(const XYZ& axis,float angle,const XYZ& pt);
107 
109  Matrix34RotateAboutAxisThrough(const XYZ& axis,const XYZ& pt);
110 };
111 
112 #endif
113 
114 
115 
116 
117 
Matrix34(const XYZ &rx, const XYZ &ry, const XYZ &rz, const XYZ &tr)
Construct from column vectors.
Definition: matrix34.h:56
Matrix34(const Matrix33 &r, const XYZ &t)
Construct from a rotation and translation.
Definition: matrix34.h:50
Matrix34()
Null constructor.
Definition: matrix34.h:46
Interface for class XYZ.
Interface for class Matrix33.
3x3 Identity matrix
Definition: matrix33.h:143
Definition: matrix34.h:86
Class to hold 3x4 matrices.
Definition: matrix34.h:34
Class to hold vectors in 3D cartesian co-ordinates.
Definition: xyz.h:34
Definition: matrix34.h:102
~Matrix34()
Destructor.
Definition: matrix34.h:62
Class to hold 3x3 matrics.
Definition: matrix33.h:30
XYZ translate
Translational component.
Definition: matrix34.h:42
Matrix34RotateAboutAxisThrough(const XYZ &axis, float angle, const XYZ &pt)
Axis must be normalized.
Definition: matrix34.cpp:24
const Matrix33 operator*(float k, const Matrix33 &m)
Multiplication by scalar.
Definition: matrix33.h:103
Matrix33 rotate
3x3 rotational component
Definition: matrix34.h:39
Definition: matrix34.h:94