Rev 5 | Rev 12 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#ifndef __CGLA_MAT4X4D_H__
#define __CGLA_MAT4X4D_H__
#include "ExceptionStandard.h"
#include "CGLA.h"
#include "Vec3d.h"
#include "Vec3Hf.h"
#include "Vec4d.h"
#include "ArithSqMat4x4Float.h"
namespace CGLA {
/** Four by four float matrix.
This class is useful for transformations such as perspective projections
or translation where 3x3 matrices do not suffice. */
class Mat4x4d: public ArithSqMat4x4Float<Vec4d, Mat4x4d>
{
public:
/// Construct a Mat4x4d from four Vec4d vectors
Mat4x4d(Vec4d _a, Vec4d _b, Vec4d _c, Vec4d _d):
ArithSqMat4x4Float<Vec4d, Mat4x4d> (_a,_b,_c,_d) {}
/// Construct the nan matrix
Mat4x4d() {}
/// Construct a matrix with identical elements.
Mat4x4d(double a):
ArithSqMat4x4Float<Vec4d, Mat4x4d> (a) {}
/// Construct from a pointed to array of 16 floats.
Mat4x4d(const float* sa): ArithSqMat4x4Float<Vec4d, Mat4x4d> (sa) {}
};
/// Create a rotation _matrix. Rotates about one of the major axes.
Mat4x4d rotation_Mat4x4d(CGLA::Axis axis, float angle);
/// Create a translation matrix
Mat4x4d translation_Mat4x4d(const Vec3d&);
/// Create a scaling matrix.
Mat4x4d scaling_Mat4x4d(const Vec3d&);
/// Create an identity matrix.
inline Mat4x4d identity_Mat4x4d()
{
return Mat4x4d(Vec4d(1,0,0,0),
Vec4d(0,1,0,0),
Vec4d(0,0,1,0),
Vec4d(0,0,0,1));
}
/** Create a perspective matrix. Assumes the eye is at the origin and
that we are looking down the negative z axis.
ACTUALLY THE EYE IS NOT AT THE ORIGIN BUT BEHIND IT. CHECK UP ON
THIS ONE */
Mat4x4d perspective_Mat4x4d(float d);
}
#endif