667 |
khor |
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 |
|
|
|
11 |
#ifndef __CGLA_MAT3X3F_H__
|
|
|
12 |
#define __CGLA_MAT3X3F_H__
|
|
|
13 |
|
|
|
14 |
#include "CGLA.h"
|
|
|
15 |
#include "Vec3f.h"
|
|
|
16 |
#include "ArithSqMat3x3Float.h"
|
|
|
17 |
|
|
|
18 |
namespace CGLA
|
|
|
19 |
{
|
|
|
20 |
|
|
|
21 |
/** \brief 3 by 3 float matrix.
|
|
|
22 |
|
|
|
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:
|
|
|
28 |
|
|
|
29 |
/// Construct matrix from 3 Vec3f vectors.
|
|
|
30 |
Mat3x3f(Vec3f _a, Vec3f _b, Vec3f _c):
|
|
|
31 |
ArithSqMat3x3Float<Vec3f, Mat3x3f> (_a,_b,_c) {}
|
|
|
32 |
|
|
|
33 |
/// Construct the 0 matrix
|
|
|
34 |
Mat3x3f() {}
|
|
|
35 |
|
|
|
36 |
/// Construct a matrix from a single scalar value.
|
|
|
37 |
explicit Mat3x3f(float a): ArithSqMat3x3Float<Vec3f, Mat3x3f>(a) {}
|
|
|
38 |
|
|
|
39 |
};
|
|
|
40 |
|
|
|
41 |
/// Create a rotation _matrix. Rotates about one of the major axes.
|
|
|
42 |
Mat3x3f rotation_Mat3x3f(CGLA::Axis axis, float angle);
|
|
|
43 |
|
|
|
44 |
/// Create a scaling matrix.
|
|
|
45 |
Mat3x3f scaling_Mat3x3f(const Vec3f&);
|
|
|
46 |
|
|
|
47 |
/// Create an identity matrix.
|
|
|
48 |
inline Mat3x3f identity_Mat3x3f()
|
|
|
49 |
{
|
|
|
50 |
return Mat3x3f(Vec3f(1.0f,0.0f,0.0f), Vec3f(0.0f,1.0f,0.0f), Vec3f(0.0f,0.0f,1.0f));
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
}
|
|
|
54 |
#endif
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|