summaryrefslogtreecommitdiff
path: root/common/vector.h
blob: 2458e3085a1000238d0e0868f867d32e55c7fd71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _VECTOR_H_
#define _VECTOR_H_

class Vector
{
public:
	Vector();
	Vector(float x, float y, float z);
	Vector(const float *point);
	Vector(const float *p1, const float *p2);
	~Vector() { };

	float Dot(Vector& vec);
	float Angle(Vector& vec);
	Vector& Cross(Vector& v1, Vector& v2);
	Vector& operator+=(Vector& add);
	Vector& operator-=(Vector& sub);
	Vector& operator*=(float scalar);

	operator const float*() const
	{ return m_fPoint; }
	void ToFloat(float *point);
	float Length();
	void Normalize();

protected:
	float m_fPoint[3];
};

#endif // _VECTOR_H_