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

JPoint Class Reference

#include <JPoint.hpp>

Inheritance diagram for JPoint::

JCircle JCylinder List of all members.

Public Methods

__inline JPoint ()
__inline JPoint (Type X)
__inline JPoint (Type X, Type Y)
__inline JPoint (const JPoint &p)
__inline const JPoint & operator= (const JPoint &p)
__inline bool operator== (const JPoint &p)
__inline bool operator!= (const JPoint &p)
__inline const JPoint & operator++ ()
__inline const JPoint & operator++ (int)
__inline const JPoint & operator-- ()
__inline const JPoint & operator-- (int)
__inline const JPoint & setPoint (Type X, Type Y)
__inline const JPoint & setPolar (FType R, FType Theta)
__inline const JPoint & setX (FType X)
__inline const JPoint & setY (FType Y)
__inline const JPoint & setR (FType R)
__inline const JPoint & setAngle (FType Theta)
__inline Type getX () const
__inline Type getY () const
__inline FType getR ()
__inline FType getAngle ()

Protected Methods

void getXYfromPolar ()
void getPolarfromXY ()

Protected Attributes

JPoint_t pt

Friends

__inline friend ostream & operator<< (ostream &os, const JPoint &p)

Constructor & Destructor Documentation

__inline JPoint::JPoint   [inline]
 

Definition at line 34 of file JPoint.hpp.

00034                    {
00035      memset( &pt, 0, sizeof( JPoint_t ) );
00036    }

__inline JPoint::JPoint Type    X [inline]
 

Definition at line 38 of file JPoint.hpp.

00038                            {
00039      memset( &pt, 0, sizeof( JPoint_t ) );
00040      pt.x = X;
00041    }

__inline JPoint::JPoint Type    X,
Type    Y
[inline]
 

Definition at line 43 of file JPoint.hpp.

00043                                    {
00044      memset( &pt, 0, sizeof( JPoint_t ) );
00045      pt.x = X;
00046      pt.y = Y;
00047    }

__inline JPoint::JPoint const JPoint &    p [inline]
 

Definition at line 49 of file JPoint.hpp.

00049                                     {
00050      memcpy( &pt, &p.pt, sizeof( JPoint_t ) );
00051    }


Member Function Documentation

__inline FType JPoint::getAngle   [inline]
 

Definition at line 149 of file JPoint.hpp.

00149                            {                  // get angle
00150       if ( !pt.PolarCache ) 
00151         getPolarfromXY();
00152       return pt.theta;
00153    }

void JPoint::getPolarfromXY   [inline, protected]
 

Definition at line 173 of file JPoint.hpp.

Referenced by getAngle(), getR(), operator++(), and operator--().

00173                          {
00174      pt.r = sqrt( pt.x * pt.x  +  pt.y * pt.y );
00175      pt.theta = atan2( pt.y, pt.x );
00176      pt.PolarCache = TRUE;
00177    }

__inline FType JPoint::getR   [inline]
 

Definition at line 143 of file JPoint.hpp.

00143                        {                      // get r coordinate
00144       if ( !pt.PolarCache ) 
00145         getPolarfromXY();
00146       return pt.r;
00147    }

__inline Type JPoint::getX   const [inline]
 

Definition at line 135 of file JPoint.hpp.

Referenced by main().

00135                             {                 // get x coordinate
00136       return pt.x;
00137    }

void JPoint::getXYfromPolar   [inline, protected]
 

Definition at line 166 of file JPoint.hpp.

Referenced by operator++(), operator--(), setAngle(), setPolar(), and setR().

00166                          {
00167       pt.PolarCache = TRUE;
00168       pt.x = pt.r * cos( pt.theta );
00169       pt.y = pt.r * sin( pt.theta );
00170    }

__inline Type JPoint::getY   const [inline]
 

Definition at line 139 of file JPoint.hpp.

Referenced by main().

00139                             {                 // get y coordinate
00140       return pt.y;
00141    }

__inline bool JPoint::operator!= const JPoint &    p [inline]
 

Definition at line 63 of file JPoint.hpp.

00063                                               {
00064      return  memcmp( &pt, &p.pt, (sizeof( Type ) * 2)  );
00065    }

__inline const JPoint& JPoint::operator++ int    [inline]
 

Reimplemented in JCircle.

Definition at line 74 of file JPoint.hpp.

00074                                            {
00075       if ( !pt.PolarCache ) getPolarfromXY();
00076       pt.r++;
00077       getXYfromPolar();
00078       return *this;
00079    }

__inline const JPoint& JPoint::operator++   [inline]
 

Reimplemented in JCircle.

Definition at line 67 of file JPoint.hpp.

Referenced by JCircle::operator++().

00067                                       {
00068       if ( !pt.PolarCache ) getPolarfromXY();
00069       pt.r++;
00070       getXYfromPolar();
00071       return *this;
00072    }

__inline const JPoint& JPoint::operator-- int    [inline]
 

Reimplemented in JCircle.

Definition at line 88 of file JPoint.hpp.

00088                                            {
00089       if ( !pt.PolarCache ) getPolarfromXY();
00090       pt.r--;
00091       getXYfromPolar();
00092       return *this;
00093    }

__inline const JPoint& JPoint::operator--   [inline]
 

Reimplemented in JCircle.

Definition at line 81 of file JPoint.hpp.

Referenced by JCircle::operator--().

00081                                       {
00082       if ( !pt.PolarCache ) getPolarfromXY();
00083       pt.r--;
00084       getXYfromPolar();
00085       return *this;
00086    }

__inline const JPoint& JPoint::operator= const JPoint &    p [inline]
 

Definition at line 53 of file JPoint.hpp.

00053                                                       {
00054      memcpy( &pt, &p.pt, sizeof( JPoint_t ) );
00055      return *this;
00056    }

__inline bool JPoint::operator== const JPoint &    p [inline]
 

Definition at line 59 of file JPoint.hpp.

00059                                               {
00060      return !memcmp( &pt, &p.pt, (sizeof( Type ) * 2)  );
00061    }

__inline const JPoint& JPoint::setAngle FType    Theta [inline]
 

Reimplemented in JCircle, and JCylinder.

Definition at line 129 of file JPoint.hpp.

Referenced by JSquare::setAngle(), JRectangle::setAngle(), and JCircle::setAngle().

00129                                                 {
00130       pt.theta = Theta;
00131       getXYfromPolar();
00132       return *this;
00133    }

__inline const JPoint& JPoint::setPoint Type    X,
Type    Y
[inline]
 

Reimplemented in JCircle, and JCylinder.

Definition at line 96 of file JPoint.hpp.

Referenced by JCircle::setCircle(), JRectangle::setJRectangle(), JRectangle::setJSquare(), JSquare::setPoint(), JRectangle::setPoint(), and JCircle::setPoint().

00096                                                     {
00097       pt.x = X;
00098       pt.y = Y;
00099       pt.PolarCache = FALSE;
00100       return *this;
00101    }

__inline const JPoint& JPoint::setPolar FType    R,
FType    Theta
[inline]
 

Reimplemented in JCircle, and JCylinder.

Definition at line 104 of file JPoint.hpp.

Referenced by JSquare::setPolar(), JRectangle::setPolar(), and JCircle::setPolar().

00104                                                           {
00105       pt.r = R;
00106       pt.theta = Theta;
00107       getXYfromPolar();
00108       return *this;
00109    }

__inline const JPoint& JPoint::setR FType    R [inline]
 

Reimplemented in JCircle, and JCylinder.

Definition at line 123 of file JPoint.hpp.

Referenced by JSquare::setR(), JRectangle::setR(), and JCircle::setR().

00123                                         {
00124       pt.r = R;
00125       getXYfromPolar();
00126       return *this;
00127    }

__inline const JPoint& JPoint::setX FType    X [inline]
 

Definition at line 111 of file JPoint.hpp.

Referenced by JSquare::setX(), JRectangle::setX(), and JCircle::setX().

00111                                         {
00112       pt.x = X;
00113       pt.PolarCache = FALSE;
00114       return *this;
00115    }

__inline const JPoint& JPoint::setY FType    Y [inline]
 

Definition at line 117 of file JPoint.hpp.

Referenced by JSquare::setY(), JRectangle::setY(), and JCircle::setY().

00117                                         {
00118       pt.y = Y;
00119       pt.PolarCache = FALSE;
00120       return *this;
00121    }


Friends And Related Function Documentation

__inline friend ostream& operator<< ostream &    os,
const JPoint &    p
[friend]
 

Definition at line 156 of file JPoint.hpp.

00157    {
00158      os << '(' << p.pt.x << ", " << p.pt.y << ')';
00159      return os;
00160    }


Member Data Documentation

struct JPoint_t JPoint::pt [protected]
 

Definition at line 163 of file JPoint.hpp.

Referenced by JPoint(), operator!=(), JCircle::operator!=(), operator<<(), operator=(), JCylinder::operator=(), JCircle::operator=(), operator==(), and JCircle::operator==().


The documentation for this class was generated from the following file:
Generated on Sun Oct 14 18:48:54 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001