summaryrefslogtreecommitdiff
path: root/common/vector.h
blob: 47f96651334719cab1f8aa872f34d2a1f8802453 (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(const Vector& vec);
	float Angle(const Vector& vec);
	Vector& Cross(const Vector& v1, const Vector& v2);
	Vector& operator+=(const Vector& add);
	Vector& operator-=(const 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_