1 #ifndef MESH_IO_LA_H_INCLUDED
2 #define MESH_IO_LA_H_INCLUDED
9 *
\e$B@~7ABe?t
\e(B(Linear Algebra)
20 Vector2(float _x, float _y)
25 inline std::ostream &operator<<(std::ostream &os, const Vector2 &rhs)
28 << '[' << rhs.x << ',' << rhs.y << ']';
42 Vector3(float _x, float _y, float _z)
46 bool operator==(const Vector3 &rhs)const
48 return x==rhs.x && y==rhs.y && z==rhs.z;
51 Vector3 operator+(const Vector3 &rhs)
53 return Vector3(x+rhs.x, y+rhs.y, z+rhs.z);
56 Vector3 operator-(const Vector3 &rhs)
58 return Vector3(x-rhs.x, y-rhs.y, z-rhs.z);
62 inline std::ostream &operator<<(std::ostream &os, const Vector3 &rhs)
65 << '[' << rhs.x << ',' << rhs.y << ',' << rhs.z << ']';
80 Vector4(float _x, float _y, float _z, float _w)
81 : x(_x), y(_y), z(_z), w(_w)
85 inline std::ostream &operator<<(std::ostream &os, const Vector4 &rhs)
88 << '[' << rhs.x << ',' << rhs.y << ',' << rhs.z << ',' << rhs.w << ']';
103 Quaternion(float _x, float _y, float _z, float _w)
104 : x(_x), y(_y), z(_z), w(_w)
107 float dot(const Quaternion &rhs)
109 return x*rhs.x + y*rhs.y + z*rhs.z + w*rhs.w;
113 inline std::ostream &operator<<(std::ostream &os, const Quaternion &rhs)
116 << '[' << rhs.x << ',' << rhs.y << ',' << rhs.z << ',' << rhs.w << ']';
124 #endif // MESH_IO_LA_H_INCLUDED