src/vector.h
branchpyrit
changeset 21 79b516a3803d
parent 14 fc18ac4833f2
equal deleted inserted replaced
20:f22952603f29 21:79b516a3803d
    31 	Vector3(): x(0.0f), y(0.0f), z(0.0f) {};
    31 	Vector3(): x(0.0f), y(0.0f), z(0.0f) {};
    32 	Vector3(float ax, float ay, float az): x(ax), y(ay), z(az) {};
    32 	Vector3(float ax, float ay, float az): x(ax), y(ay), z(az) {};
    33 
    33 
    34 	// index operator
    34 	// index operator
    35 	float &operator[](int index)	{ return cell[index]; };
    35 	float &operator[](int index)	{ return cell[index]; };
       
    36 
       
    37 	bool operator==(Vector3 &v) { return x==v.x && y==v.y && z==v.z; };
    36 
    38 
    37 	// normalize
    39 	// normalize
    38 	Vector3 normalize()
    40 	Vector3 normalize()
    39 	{
    41 	{
    40 		float f = 1.0f / mag();
    42 		float f = 1.0f / mag();