From 7a4800b080fec82e237f268e8853fa808367c89d Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 16 Jul 2000 19:51:52 +0000 Subject: Added -= operator. git-svn-id: http://svn.leocad.org/trunk@83 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- common/vector.h | 58 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'common/vector.h') diff --git a/common/vector.h b/common/vector.h index de613dc..4a2d5de 100644 --- a/common/vector.h +++ b/common/vector.h @@ -7,37 +7,41 @@ 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); + public: + Vector (); + Vector (float x, float y, float z); + Vector (const float *point); + Vector (const float *p1, const float *p2); + virtual ~Vector (); - Vector& Cross(Vector& v1, Vector& v2); + float X () + { return m_fPoint[0]; } + float Y () + { return m_fPoint[1]; } + float Z () + { return m_fPoint[2]; } - 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); + float Dot (Vector& vec); + float Angle (Vector& vec); + Vector& Cross (Vector& v1, Vector& v2); + void Add (const float *point); + void Add (float x, float y, float z); + Vector& operator+=(Vector& add); + Vector& operator-=(Vector& sub); + Vector& operator*=(float scalar); + Vector& operator=(Vector& source); + Vector& operator=(const float *point); + bool operator==(Vector& vec); - Vector(float x, float y, float z); - Vector(float point[3]); - Vector(float p1[3], float p2[3]); - Vector(); - virtual ~Vector(); + void ToFloat (float *point); + void FromFloat (const float *point); + void FromFloat (float x, float y, float z); + float Length (); + void Normalize (); + void Scale (float scale); -protected: - float m_fPoint[3]; + protected: + float m_fPoint[3]; }; #endif // _VECTOR_H_ -- cgit v1.2.3