#ifndef MAT2_H
#define MAT2_H

/*
** Implementation of a homogeneous 2D transform matrix, using
** the abstract Mat class as a base.
*/

#include "Vec2.h"

namespace Salamander
{

class Mat2 : public Mat<Mat2, Vec2>
{
public:
	virtual ~Mat2();

public:
	Mat2();
	Mat2(double rotation);
	Mat2(const Vec2& translation, const Vec2& scale = Vec2(1.0f, 1.0f), double rotation = 0.0f);
	Mat2(double a, double b, double c, double d, double x, double y, double s, double t);

	void setTranslation(const Vec2& translation);
	Vec2 getTranslation() const;

	void setScale(const Vec2& scale);
	Vec2 getScale() const;

	void setRotation(double rotation);
	double getRotation() const;

	Mat2 transpose() const;
	Mat2 inverse() const;
	double determinant() const;

	Mat2 operator + (const Mat2& rhs);
	Mat2 operator * (const Mat2& rhs);
	Vec2 operator * (const Vec2& rhs);

private:
	// rotation/sheer matrix
	double a_;	double b_;
	double c_;	double d_;

	// translation
	double x_;
	double y_;

	// scale
	double s_;
	double t_;
};

}

#endif // MAT2_H
