summaryrefslogtreecommitdiff
path: root/common/vector.h
diff options
context:
space:
mode:
authorleo2000-07-16 19:51:52 +0000
committerleo2000-07-16 19:51:52 +0000
commit7a4800b080fec82e237f268e8853fa808367c89d (patch)
treee78476fff55f1e792e40102592c67d611d84386e /common/vector.h
parentc5405b0353abd24684cb0b52001d299198f1fa0e (diff)
Added -= operator.
git-svn-id: http://svn.leocad.org/trunk@83 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/vector.h')
-rw-r--r--common/vector.h58
1 files changed, 31 insertions, 27 deletions
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_