summaryrefslogtreecommitdiff
path: root/common/vector.h
blob: de613dc5d603cec5c473b49aade4cb8ccf24975c (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
31
32
33
34
35
36
37
38
39
40
41
42
43
// Vector.h: interface for the Vector class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _VECTOR_H_
#define _VECTOR_H_

class Vector  
{
public:
	float X();
	float Y();
	float Z();
	float Dot(Vector& vec);
	float Angle(Vector& vec);
	void Add(float point[3]);
	void Add(float x, float y, float z);
	Vector& operator+=(Vector& add);
	Vector& operator*=(float scalar);
	Vector& operator=(Vector& source);
	Vector& operator=(float point[3]);
	bool operator==(Vector& vec);

	Vector& Cross(Vector& v1, Vector& v2);

	void ToFloat(float point[3]);
	void FromFloat(float point[3]);
	void FromFloat(float x, float y, float z);
	float Length();
	void Normalize();
	void Scale(float scale);

	Vector(float x, float y, float z);
	Vector(float point[3]);
	Vector(float p1[3], float p2[3]);
	Vector();
	virtual ~Vector();

protected:
	float m_fPoint[3];
};

#endif // _VECTOR_H_