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

Trd2.cxx

Go to the documentation of this file.
00001 // $Id: Trd2.cxx,v 1.1.1.1 1999/12/20 22:28:07 burnett Exp $
00002 //
00003 
00004 #include "geometry/Trd2.h"
00005 
00006 
00007 Trd2::Trd2( double sl, double ll, double sw, double lw, double h )
00008 : Hexahedron()
00009 {
00010 //  Make a Trd2 with short_length (sl) and long_length (ll) along x-axis,
00011 //  short_width (sw) and long_width along y-axis,
00012 //  and height (h) along z-axis.
00013     if ( ( sl <= 0.0 ) || ( ll <= 0.0 ) ||
00014              ( sw <= 0.0 ) || ( lw <= 0.0 ) || ( h <= 0.0 )
00015                         || ( ll < sl )
00016                         || ( lw < sw )
00017            ) FATAL("Illegal parameters for Trd2");
00018         max_dimension = 0.5 * sqrt( ll*ll  + lw*lw + h*h );
00019 
00020     double ldif = 0.5 *(ll - sl),
00021            wdif = 0.5 *(lw - sw),
00022            lsum = 0.25*(lw + sw),
00023            wsum = 0.25*(lw + sw),
00024            lh = sqrt( h*h + ldif * ldif ),
00025            wh = sqrt( h*h + wdif * wdif );
00026 
00027     // Planes at +x, -x
00028         double c = h/lh,
00029                s = ldif/lh,
00030                d = lsum*c; // distance to x-planes
00031         addPlane( d*Vector( c,0,-s) );
00032         addPlane( d*Vector(-c,0,-s) );
00033 
00034         // Planes at +y, -y
00035     c = h/wh; s = wdif/wh; d = wsum*c;
00036         addPlane( d* Vector(0, c,-s) );
00037         addPlane( d* Vector(0,-c,-s) );
00038 
00039     // Planes at +z, -z
00040         addPlane( Vector(0,0,  0.5*h) );
00041         addPlane( Vector(0,0, -0.5*h) );
00042 
00043 }
00044 
00045 double Trd2::shortLength() const{return 0;}      // fix when someone complains
00046 double Trd2::longLength()  const{return 0;}
00047 double Trd2::shortWidth()  const{return 0;}
00048 double Trd2::longWidth()  const{return 0;}
00049 double Trd2::height() const{return 0;}
00050 
00051 
00052 void Trd2::printOn( std::ostream& os ) const
00053 {
00054    Volume::printOn(os);
00055     os  << " short_length " << shortLength()
00056         << ",long_length "  << longLength()
00057         << "\n  short_width " << shortWidth()
00058         << ", long_width " << longWidth()
00059         << ", and height " << height()
00060         << "\n";
00061 }
00062 
00063 
00064 
00065 

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