00001
00002
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)
00013 {
00014
00015
00016
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
00033
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