#ifndef GENTRAPEZOID_HH #define GENTRAPEZOID_HH //============================================================================ // // Class : GenTrapezoid // Created : 20-DEC-1997 by Stephen Kahn // Purpose : Characterize a GeometryElement as a TRAPezoid // //============================================================================ #include #include namespace dgs { /// A generalized trapezoid. class GenTrapezoid : public GeometryElement { private : /// half length along local z-direction double _dz_bot; double _dz_top; /// polar angle of line joining faces double _thet; /// azimuth angle of line joining faces double _phi; /// y half length for face double _h1; /// y half length for face double _h2; /// x half length at bottom double _bl1; /// x half length at bottom double _bl2; /// x half length at top double _tl1; /// x half length at top double _tl2; /// angle of median y tilt wrt y-axis double _alp1; /// angle of median y tilt wrt y-axis double _alp2; /// angle of median z tilt wrt z-axis double _beta; /// Trapezoid center. CartesianCoordinate _TrapCenter; /// Support for positioning children. CartesianCoordinate xform_to_local(const GeometryXform&) const; /// Support for positioning children. GeometryXform local_to_xform(const CartesianCoordinate&) const; /// RCS version std::string _cvers; // Replaced at checkout public : /// Default constructor. GenTrapezoid(): _cvers("Revision:$") {} /// Construct trapezoid with specified size. GenTrapezoid(double dz, double thet, double phi, double h1, double h2, double bl1, double bl2, double tl1, double tl2, double alp1, double alp2) : _dz_bot(dz), _dz_top(dz), _thet(thet), _phi(phi), _h1(h1), _h2(h2), _bl1(bl1), _bl2(bl2), _tl1(tl1), _tl2(tl2), _alp1(alp1), _alp2(alp2), _cvers("Revision:$") {} /// Construct trapezoid with different lengths on top and bottom GenTrapezoid(double dz1, double dz2, double thet, double phi, double h1, double h2, double bl1, double bl2, double tl1, double tl2, double alp1, double alp2, double beta) : _dz_bot(dz1), _dz_top(dz2), _thet(thet), _phi(phi), _h1(h1), _h2(h2), _bl1(bl1), _bl2(bl2), _tl1(tl1), _tl2(tl2), _alp1(alp1), _alp2(alp2), _beta(beta), _cvers("Revision:$") {} /// Fill trapezoid. void fill_Trap(double, double, double, double, double, double, double, double, double, double, double); /// Fill trapezoid with different lengths on top and bottom void fill_Trap(double, double, double, double, double, double, double, double, double, double, double, double, double); /// Get dz. ( defaults to dz_bot) double get_dz() const; /// Get dz on top double get_dz_top() const; /// Get dz on bottom double get_dz_bot() const; /// Get theta. double get_thet() const; /// Get phi. double get_phi() const; /// Get h1. double get_h1() const; /// Get h2. double get_h2() const; /// Get bl2. double get_bl2() const; /// Get bl1. double get_bl1() const; /// Get tl1. double get_tl1() const; /// Get tl2. double get_tl2() const; /// Get alp1. double get_alp1() const; /// Get alp2. double get_alp2() const; /// Get beta. double get_beta() const; /// Convert local point to global one. SpacePoint local_to_global( const CartesianCoordinate&) const; /// Convert global point to local one. CartesianCoordinate global_to_local(const SpacePoint&) const; /// Set center of trapezoid to specified Cartesian point. void set_center_xyz( double, double, double); void set_center_xyz(); // set from Xform /// Set Xform. void set_Xform(double, double, double, double); /// Position child surface at specfied local point. bool position_child_at( const CartesianCoordinate&, GeometryElement& ); bool position_child_at( const GeometryXform&, GeometryElement&); /// Get center of trapezoid. CartesianCoordinate get_center() const { return _TrapCenter;} /// Get source code version. Kept to allow following code changes const std::string& code_version() const { return _cvers; } D0_OBJECT_SETUP(GenTrapezoid); // persistent class }; } #endif // GENTRAPEZOID_HH