From: Mikko Rasa Date: Tue, 14 May 2013 20:11:38 +0000 (+0300) Subject: Add a Vector2 class X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ec9e0699ef686a3314d4c9ee0f39b29a92d3aeed;p=libs%2Fmath.git Add a Vector2 class --- diff --git a/source/linal/dummy.cpp b/source/linal/dummy.cpp index 28e681a..25e76a3 100644 --- a/source/linal/dummy.cpp +++ b/source/linal/dummy.cpp @@ -1,9 +1,8 @@ #include "vector.h" +#include "vector2.h" #include "vector3.h" #include "matrix.h" #include "squarematrix.h" -#include "matrix4.h" /* This dummy file is needed to make Builder happy, and also serves as a syntax check by pulling in all the headers. */ -void dummy() { } diff --git a/source/linal/vector2.h b/source/linal/vector2.h new file mode 100644 index 0000000..fed7721 --- /dev/null +++ b/source/linal/vector2.h @@ -0,0 +1,30 @@ +#ifndef MSP_LINAL_VECTOR2_H_ +#define MSP_LINAL_VECTOR2_H_ + +#include "vector.h" + +namespace Msp { +namespace LinAl { + +template +class Vector2: public Vector +{ +public: + Vector2() { } + Vector2(const T *d): Vector(d) { } + Vector2(T, T); + template + Vector2(const Vector &v): Vector(v) { } +}; + +template +inline Vector2::Vector2(T x, T y) +{ + this->data[0] = x; + this->data[1] = y; +} + +} // namespace LinAl +} // namespace Msp + +#endif