660 |
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 Mat3x3d.h
|
|
|
8 |
* @brief 3x3 double matrix class
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
#ifndef __CGLA_MAT3X3D_H__
|
|
|
12 |
#define __CGLA_MAT3X3D_H__
|
|
|
13 |
|
|
|
14 |
#include "CGLA.h"
|
|
|
15 |
#include "Vec3d.h"
|
|
|
16 |
#include "ArithSqMat3x3Float.h"
|
|
|
17 |
|
|
|
18 |
namespace CGLA {
|
|
|
19 |
|
|
|
20 |
/** \brief 3 by 3 double matrix.
|
|
|
21 |
|
|
|
22 |
This class will typically be used for rotation or
|
|
|
23 |
scaling matrices for 3D vectors. */
|
|
|
24 |
class Mat3x3d: public ArithSqMat3x3Float<Vec3d, Mat3x3d>
|
|
|
25 |
{
|
|
|
26 |
public:
|
|
|
27 |
|
|
|
28 |
/// Construct matrix from 3 Vec3d vectors.
|
|
|
29 |
Mat3x3d(Vec3d _a, Vec3d _b, Vec3d _c):
|
|
|
30 |
ArithSqMat3x3Float<Vec3d, Mat3x3d> (_a,_b,_c) {}
|
|
|
31 |
|
|
|
32 |
/// Construct the 0 matrix
|
|
|
33 |
Mat3x3d() {}
|
|
|
34 |
|
|
|
35 |
/// Construct a matrix from a single scalar value.
|
|
|
36 |
explicit Mat3x3d(float a): ArithSqMat3x3Float<Vec3d, Mat3x3d>(a) {}
|
|
|
37 |
|
|
|
38 |
};
|
|
|
39 |
|
|
|
40 |
/// Create a rotation _matrix. Rotates about one of the major axes.
|
|
|
41 |
Mat3x3d rotation_Mat3x3d(CGLA::Axis axis, double angle);
|
|
|
42 |
|
|
|
43 |
/// Create a scaling matrix.
|
|
|
44 |
Mat3x3d scaling_Mat3x3d(const Vec3d&);
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/// Create an identity matrix.
|
|
|
48 |
inline Mat3x3d identity_Mat3x3d()
|
|
|
49 |
{
|
|
|
50 |
return Mat3x3d(Vec3d(1.0,0.0,0.0), Vec3d(0.0,1.0,0.0), Vec3d(0.0,0.0,1.0));
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
}
|
|
|
54 |
#endif
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|