Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Deprecated/old_18mar_diff/Vector/Vector2D.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__JVector2D_HPP__
00002 #define __J2K__JVector2D_HPP__
00003 
00004 #define MATH_PI 3.141592653589793238462643
00005 
00006 class JVector2D {
00007 public:
00008   JVector2D();
00009   JVector2D( const JVector2D& v );
00010   JVector2D( const double x, const double y );
00011 
00012   JVector2D& operator=( const JVector2D& v );
00013 
00014   BOOL operator==( const JVector2D& v ) const;
00015   BOOL operator!=( const JVector2D& v ) const;
00016 
00017   friend JVector2D operator+( const JVector2D& left, const JVector2D& right );
00018   friend JVector2D operator-( const JVector2D& left, const JVector2D& right );
00019   friend JVector2D operator*( const JVector2D& left, const JVector2D& right );
00020   friend JVector2D operator/( const JVector2D& left, const JVector2D& right );
00021 
00022   friend JVector2D operator*( const JVector2D& left, const double r );
00023   friend JVector2D operator/( const JVector2D& left, const double r );
00024 
00025   void operator+=( const JVector2D& v );
00026   void operator-=( const JVector2D& v );
00027   void operator*=( const JVector2D& v );
00028   void operator/=( const JVector2D& v );
00029 
00030   void operator*=( const double r );
00031   void operator/=( const double r );
00032 
00033   double X() const;
00034   double X( const double x );
00035   double Y() const;
00036   double Y( const double y );
00037 
00038   void Set( const double x, const double y );
00039 
00040   BOOL bAtOrg() const;
00041   double Magnitude() const;
00042 
00043   void Negate();
00044   void Normalize();
00045   void Square();
00046   void ToRadians();
00047 
00048 
00049   friend double   Dot( const JVector2D& left, const JVector2D& right );
00050 
00051   friend JVector2D vecHalfBetween( const JVector2D& left,
00052                                   const JVector2D& right );
00053 
00054 private:
00055   double X;
00056   double Y;
00057 };
00058 
00059 // ---------------------------------------------------------------------------
00060 //  Typedef the vector to TFPoint so that it can be more self documenting
00061 //  when used as a point in a floating point space.
00062 // ---------------------------------------------------------------------------
00063 typedef JVector2D   TFPoint;
00064 
00065 #endif

Generated on Sun Oct 14 18:46:16 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001