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

Trd1.cxx

Go to the documentation of this file.
00001 // $Id: Trd1.cxx,v 1.1.1.1 1999/12/20 22:28:07 burnett Exp $
00002 //
00003 #include "geometry/Trd1.h"
00004 
00005 static Vector xhat(1,0,0),yhat(0,1,0), zhat(0,0,1);
00006 
00007 Trd1::Trd1( double sl, double ll, double w, double h )
00008 : Hexahedron()
00009 {
00010   //  Make a Trd1 with short_length (sl) and long_length (ll) along x-axis,
00011   //  width (w) along y-axis, and height (h) along z-axis.
00012   //  As with GEANT, the 2 Trapezoids are in the x-z plane.
00013 
00014   //  Require the long_length to be longer than or equal to the short_length
00015   if ( ( sl <= 0.0 ) || ( ll <= 0.0 ) || ( w <= 0.0 ) || ( h <= 0.0 )
00016          || ( ll < sl )
00017      ) FATAL("Illegal parameters in Trd1");
00018 
00019   max_dimension = 0.5 * sqrt( ll*ll + w*w + h*h );
00020 
00021   // +x, -x planes: note z-component
00022   double a = atan(0.5*(ll-sl)/h ),
00023          s = sin(a),
00024          c = cos(a),
00025          d = c* 0.25*(ll+sl) ;// perp distance to planes
00026 
00027   addPlane( d * Vector( c, 0, -s));
00028   addPlane( d * Vector(-c, 0, -s));
00029 
00030   // +y, -y planes:
00031   addPlane(  0.5*w * yhat);
00032   addPlane( -0.5*w * yhat);
00033 
00034   // +z, -z planes:
00035   addPlane(  0.5*h * zhat);
00036   addPlane( -0.5*h * zhat);
00037 }
00038 
00039 
00040 double Trd1::shortLength() const{return 0;}      // fix when someone complains
00041 double Trd1::longLength()  const{return 0;}
00042 double Trd1::width()  const{return 0;}
00043 double Trd1::height() const{return 0;}
00044 
00045 void Trd1::printOn( std::ostream& os ) const
00046 {
00047     Volume::printOn(os);
00048          os    << "short_length "  << shortLength()
00049            << ", long_length " << longLength()
00050            << "\n width "      << width()
00051            << ", height "      << height()
00052            << "\n";
00053 }
00054 
00055 
00056 
00057 

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