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

C:/temp/src/j2k/Beta/Geometry/CylTest.cpp

Go to the documentation of this file.
00001 // Test program for class JCylinder
00002 
00003 #include <j2k/Fred/Standard.hpp>
00004 #include <iostream.h>
00005 #include <iomanip.h>
00006 
00007 #define __J2K__Need_JCylinder_double_double
00008 #include <j2k/Fred/Geometry/Macro/MC_JCylinder.hpp>
00009 
00010 // Alias
00011 #define JPoint      JPoint_double_double
00012 #define JCircle     JCircle_double_double
00013 #define JCylinder   JCylinder_double_double
00014 
00015 int main()
00016 {
00017    // create JCylinder object
00018    JCylinder cyl( 5.7, 2.5, 12, 23 );
00019 
00020    // use get functions to display the JCylinder
00021    cout <<   "X coordinate is " << cyl.getX()
00022         << "\nY coordinate is " << cyl.getY()
00023         << "\nRadius is "       << cyl.getRadius()
00024         << "\nHeight is "       << cyl.getHeight()
00025         << "\n\n";
00026 
00027    // use set functions to change the JCylinder's attributes
00028    cyl.setPoint( 2, 2 ).setRadius( 4.25 ).setHeight( 10 );
00029    cout << "The new location, radius, and height of cyl are:\n"
00030         << cyl << '\n';
00031 
00032    // display the JCylinder as a Point
00033    JPoint& pRef = cyl;   // pRef "thinks" it is a Point
00034 
00035    cout << "\nJCylinder printed as a Point is: " 
00036         << pRef << "\n\n";
00037    
00038    // display the JCylinder as a JCircle
00039    JCircle& JCircleRef = cyl;  // JCircleRef thinks it is a JCircle
00040 
00041    cout << "JCylinder printed as a JCircle is:\n" << JCircleRef
00042         << "\nArea: " << JCircleRef.area() << endl;
00043 
00044    return 0;
00045 }
00046 
00047 

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