Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Sphe.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/geometry/src/Sphe.cxx,v 1.1.1.1 1999/12/20 22:28:06 burnett Exp $
00002 //  Author: T. Burnett
00003 //
00004 #include "geometry/Sphe.h"
00005 
00006 #include "geometry/Sphere.h"
00007 
00008 
00009 Sphe::Sphe( double ri, double ro,
00010         double th1, double th2,
00011         double ph1, double ph2 )
00012         : Volume(3)  //THB: temporary to allow cap to function
00013 {
00014 //  Make a Sphe with inner radius ri, outer radius ro, lower polar limit
00015 //  th1, upper polar limit th2, lower azimuthal limit ph1, and upper azimuthal
00016 //  limit ph2.
00017 
00018         if ( ( ri < 0.0 ) || ( ro <= ri ) || ( th1 < 0.0 ) || ( th1 >= M_PI )
00019           || ( th2 <= th1 ) || ( th2 > ( th1 + M_PI ) ) || ( ph1 < 0.0 )
00020           || ( ph1 >= 2*M_PI ) || ( ph2 <= ph1 ) || ( ph2 > ( ph1 + 2*M_PI ) ) )
00021         {
00022                 FATAL("Dimensions of Sphe are invalid");
00023         }
00024         inner_radius  = ri;
00025         outer_radius  = ro;
00026         theta_1 = th1;
00027         theta_2 = th2;
00028         phi_1 = ph1;
00029         phi_2 = ph2;
00030 
00031 
00032 //  Set the flags to indicate how many surfaces will be needed to describe
00033 //  this Sphe.
00034         full_polar =  fabs( theta_2 - theta_1 - M_PI ) <= FLT_EPSILON ;
00035         full_azimuth =  fabs( phi_2 - phi_1 - 2*M_PI ) <= FLT_EPSILON ;
00036 
00037         if( !full_polar || !full_azimuth )
00038            FATAL("Partial sphe not yet implemented, sorry");
00039 
00040         addSurface(new Sphere(center(), ro) );
00041         if( ri>0 )
00042            addSurface(new Sphere(center(), -ri) );
00043 
00044 }
00045 
00046 
00047 void Sphe::printOn( std::ostream& os ) const
00048 {
00049   Shape::printOn(os);
00050   os   << "\t radius range:      " << innerRadius() << " - " << outerRadius() << "\n"
00051        << "\t polar angle range: " << theta1() << " - " << theta2() << " radians\n"
00052        << "\t azimuthal range:   " << phi1() << " - " << phi2() << " radians\n";
00053 
00054 }
00055 

Generated at Mon Nov 26 18:18:21 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000