Subversion Repositories gelsvn

Rev

Rev 595 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
595 jab 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
7
/** @file Mat3x3f.h
8
 * @brief 3x3 float matrix class
9
 */
10
 
2 bj 11
#ifndef __CGLA_MAT3X3F_H__
12
#define __CGLA_MAT3X3F_H__
13
 
14
#include "CGLA.h"
15
#include "Vec3f.h"
16
#include "ArithSqMat3x3Float.h"
17
 
12 jab 18
namespace CGLA 
19
{
2 bj 20
 
89 jab 21
  /** \brief 3 by 3 float matrix.
22
 
12 jab 23
      This class will typically be used for rotation or
24
      scaling matrices for 3D vectors. */
25
  class Mat3x3f: public ArithSqMat3x3Float<Vec3f, Mat3x3f>
26
    {
27
    public:
2 bj 28
 
12 jab 29
      /// Construct matrix from 3 Vec3f vectors.
30
      Mat3x3f(Vec3f _a, Vec3f _b, Vec3f _c): 
31
	ArithSqMat3x3Float<Vec3f, Mat3x3f> (_a,_b,_c) {}
2 bj 32
 
12 jab 33
      /// Construct the 0 matrix
34
      Mat3x3f() {}
2 bj 35
 
12 jab 36
      /// Construct a matrix from a single scalar value.
37
      explicit Mat3x3f(float a): ArithSqMat3x3Float<Vec3f, Mat3x3f>(a) {}
2 bj 38
 
12 jab 39
    };
2 bj 40
 
12 jab 41
  /// Create a rotation _matrix. Rotates about one of the major axes.
42
  Mat3x3f rotation_Mat3x3f(CGLA::Axis axis, float angle);
2 bj 43
 
12 jab 44
  /// Create a scaling matrix.
45
  Mat3x3f scaling_Mat3x3f(const Vec3f&);
2 bj 46
 
12 jab 47
  /// Create an identity matrix.
48
  inline Mat3x3f identity_Mat3x3f()
49
    {
501 jrf 50
      return Mat3x3f(Vec3f(1.0f,0.0f,0.0f), Vec3f(0.0f,1.0f,0.0f), Vec3f(0.0f,0.0f,1.0f));
12 jab 51
    }
2 bj 52
 
53
}
54
#endif
55
 
56
 
57
 
58
 
59
 
60
 
61