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

C:/temp/src/j2k/Beta/Geometry/Linear/Square.hpp

Go to the documentation of this file.
00001 // Definition of class JSquare
00002 #ifndef __J2K__JSquare_HPP__
00003 #define __J2K__JSquare_HPP__
00004 
00005 // Member function definitions for class JSquare
00006 #include <j2k/Fred/StdTypes.hpp>
00007 #include <j2k/Fred/Basic.hpp>
00008 #include <j2k/Fred/Geometry/Point.hpp>
00009 
00010 class JSquare {
00011 public:
00012    JSquare()                                    // Default Constructor
00013    JSquare( double X );                         // Constructor ( x, 0 )
00014    JSquare( double X, double Y );               // Constructor ( x, y )
00015    JSquare( double X, double Y, double length );
00016 
00017 
00018    double  getLength() const;                        // Get Length
00019    double  area() const;                             // Calculate area
00020 
00021    // Set coordinates (x,y)
00022    inline JSquare& setJSquare( double X, double Y, double Length );
00023 
00024    inline JSquare& setLength( double Length );       // Set Length
00025 
00026    inline void check();
00027 
00028    // Same as Point
00029    inline JSquare& setPoint( double X, double Y );   // Set coordinates (x,y)
00030    inline JSquare& setPolar( double X, double Y );   // Set coordinates (r,t)
00031 
00032    inline JSquare& setX( double X );                 // Set x coordinate
00033    inline JSquare& setY( double Y );                 // Set y coordinate
00034    inline JSquare& setR( double R );                 // Set r coordinate
00035    inline JSquare& setAngle( double Theta );         // Set angle
00036 
00037    inline double getX() const;                      // get x coordinate
00038    inline double getY() const;                      // get y coordinate
00039    inline double getR() const;                      // get r coordinate
00040    inline double getAngle() const;                  // get angle
00041 
00042    // Output a JSquare in the form:
00043    // Center = [x, y]; Length = #.##
00044    friend ostream&  operator<<( ostream &output, const JSquare &sq )
00045    {
00046      output << "Position = " << sq.p
00047             << "; Length = " 
00048             << setiosflags( ios::fixed | ios::showpoint )
00049             << setprecision( 2 ) << sq.Length;
00050      return output;                       //  Enable cascaded calls
00051    }
00052 
00053 protected:                                // accessible to derived classes
00054    JPoint& p;                             // Point to center of JSquare
00055    double length;                         // Length of the JSquar
00056    double area_cache;                     // Cached Area is valid, if > 0
00057 };
00058 
00059 #endif
00060 
00061 

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