00001
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
00011
00012
00013
00014
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
00022 double a = atan(0.5*(ll-sl)/h ),
00023 s = sin(a),
00024 c = cos(a),
00025 d = c* 0.25*(ll+sl) ;
00026
00027 addPlane( d * Vector( c, 0, -s));
00028 addPlane( d * Vector(-c, 0, -s));
00029
00030
00031 addPlane( 0.5*w * yhat);
00032 addPlane( -0.5*w * yhat);
00033
00034
00035 addPlane( 0.5*h * zhat);
00036 addPlane( -0.5*h * zhat);
00037 }
00038
00039
00040 double Trd1::shortLength() const{return 0;}
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