Subversion Repositories gelsvn

Rev

Rev 12 | Rev 50 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 jab 1
#ifndef __CGLA_MAT4X4D_H__
2
#define __CGLA_MAT4X4D_H__
3
 
4
#include "ExceptionStandard.h"
5
#include "CGLA.h"
6
#include "Vec3d.h"
7
#include "Vec3Hf.h"
8
#include "Vec4d.h"
9
#include "ArithSqMat4x4Float.h"
10
 
11
 
12
namespace CGLA {
13
 
14
 
12 jab 15
  /** Four by four float matrix.
16
      This class is useful for transformations such as perspective projections 
17
      or translation where 3x3 matrices do not suffice. */
18
  class Mat4x4d: public ArithSqMat4x4Float<Vec4d, Mat4x4d>
19
    {
20
    public:
5 jab 21
 
12 jab 22
      /// Construct a Mat4x4d from four Vec4d vectors
23
      Mat4x4d(Vec4d _a, Vec4d _b, Vec4d _c, Vec4d _d): 
24
	ArithSqMat4x4Float<Vec4d, Mat4x4d> (_a,_b,_c,_d) {}
5 jab 25
 
12 jab 26
      /// Construct the nan matrix
27
      Mat4x4d() {}
5 jab 28
 
12 jab 29
      /// Construct a matrix with identical elements.
43 jrf 30
      explicit Mat4x4d(double a): ArithSqMat4x4Float<Vec4d, Mat4x4d> (a) {}
12 jab 31
    };
10 jab 32
 
12 jab 33
  /// Create a rotation _matrix. Rotates about one of the major axes.
34
  Mat4x4d rotation_Mat4x4d(CGLA::Axis axis, float angle);
5 jab 35
 
12 jab 36
  /// Create a translation matrix
37
  Mat4x4d translation_Mat4x4d(const Vec3d&);
5 jab 38
 
12 jab 39
  /// Create a scaling matrix.
40
  Mat4x4d scaling_Mat4x4d(const Vec3d&);
5 jab 41
 
12 jab 42
  /// Create an identity matrix.
43
  inline Mat4x4d identity_Mat4x4d()
44
    {
45
      return Mat4x4d(Vec4d(1,0,0,0), 
46
		     Vec4d(0,1,0,0), 
47
		     Vec4d(0,0,1,0), 
48
		     Vec4d(0,0,0,1));
49
    }
5 jab 50
}
51
#endif
52
 
53
 
54
 
55
 
56
 
57
 
58