#pragma once
#include <mof/math/basic_matrix.hpp>

namespace mof
{
namespace math
{
	class vector3;

	/**
	 * @brief 3æ¬¡ååæ¬¡åº§æ¨å¤æè¡åã¯ã©ã¹
	 */
	class matrix3 : public basic_matrix<3, matrix3, vector3>
	{
	public:
//{{{ constructor
		/**
		 * @brief ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
		 * @note  å¹çã®ããï¼åæåã¯è¡ãããªã
		 */
		matrix3()
		{
		}

		/**
		 * @brief æå®ããå¤ã§åæåããï¼
		 * @tparam     T   éååï¼operator[]ããªã¼ãã¼ã­ã¼ããã¦ãããã¨ï¼
		 * @param[in]  arr åæåç¨éå
		 */
		template <class T>
		explicit matrix3(const T& arr)
		{
			for (size_t i = 0; i < size(); ++i) {
				elements_[i] = arr[i];
			}
		}

		/**
		 * @brief æå®ããå¤ã§åæåããï¼
		 */
		matrix3
		(
			float m11, float m12, float m13, float m14,
			float m21, float m22, float m23, float m24,
			float m31, float m32, float m33, float m34
		)
		{
			const float* table[] =
				{
					&m11, &m12, &m13, &m14,
					&m21, &m22, &m23, &m24,
					&m31, &m32, &m33, &m34
				};
			for (size_t i = 0; i < size(); ++i) {
				elements_[i] = *table[i];
			}
		}

//}}}
//{{{ copy constructor
	matrix3(const matrix3& rhs)
	{
		for (size_t i = 0; i < size(); ++i) {
			elements_[i] = rhs.elements_[i];
		}
	}
//}}}
//{{{ operator =
	/**
	 * @note ã³ãã¼ã®ããã©ã¼ãã³ã¹ã®ããã«ãã®é¢æ°ã®å®ç¾©ã¯éè¦
	 */
	matrix3& operator = (const matrix3& rhs)
	{
		for (size_t i = 0; i < size(); ++i) {
			elements_[i] = rhs.elements_[i];
		}
		return *this;
	}
//}}}
	};

}// namespace math
}// namespace mof
