00001
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
00011
00012
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
00028 double c = h/lh,
00029 s = ldif/lh,
00030 d = lsum*c;
00031 addPlane( d*Vector( c,0,-s) );
00032 addPlane( d*Vector(-c,0,-s) );
00033
00034
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
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;}
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