//============================================================================= // // File: GenTrapezoid.cpp // Created: 20-DEC-1997 by Stephen Kahn // Purpose: provide GenTrapezoid methods // //============================================================================ #include #include #include using namespace dgs; // // Accessors // double GenTrapezoid::get_dz() const { return _dz_bot; } double GenTrapezoid::get_thet() const { return _thet; } double GenTrapezoid::get_phi() const { return _phi; } double GenTrapezoid::get_h1() const { return _h1; } double GenTrapezoid::get_h2() const { return _h2; } double GenTrapezoid::get_bl2() const { return _bl2; } double GenTrapezoid::get_bl1() const { return _bl1; } double GenTrapezoid::get_tl1() const { return _tl1; } double GenTrapezoid::get_tl2() const { return _tl2; } double GenTrapezoid::get_alp1() const { return _alp1; } double GenTrapezoid::get_alp2() const { return _alp2; } double GenTrapezoid::get_dz_bot() const { return _dz_bot; } double GenTrapezoid::get_dz_top() const { return _dz_top; } double GenTrapezoid::get_beta() const { return _beta; } // // fill_Trap // void GenTrapezoid::fill_Trap(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; _beta = 0; } void GenTrapezoid::fill_Trap(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; } // // local_to_global // SpacePoint GenTrapezoid::local_to_global(const CartesianCoordinate& lpt) const { return GeometryElement::local_to_global( lpt); } // // global_to_local // CartesianCoordinate GenTrapezoid::global_to_local(const SpacePoint& gpt) const { CartesianCoordinate lxyz = get_position().invert(gpt); return lxyz; } // // xform_to_local // Purpose : Convert a (local) transformation describing a point in // a trapezoid to its local cartesian coordinates // CartesianCoordinate GenTrapezoid::xform_to_local(const GeometryXform& xf) const { CartesianCoordinate lxyz( xf[0], xf[1], xf[2]); return lxyz; } // // local_to_xform // GeometryXform GenTrapezoid::local_to_xform(const CartesianCoordinate& lpt) const { return GeometryXform(lpt.x(),lpt.y(),lpt.z(),0.,0.,0.); } // // set_center_xyz // void GenTrapezoid::set_center_xyz( double xx, double yy, double zz) { CartesianCoordinate center( xx, yy, zz); _TrapCenter = center; } void GenTrapezoid::set_center_xyz() { CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _TrapCenter = gcen; } // // set_Xform // void GenTrapezoid::set_Xform( double xx, double yy, double zz, double psi) { GeometryXform Tform( xx, yy, zz, 0., 0., -psi); GeometryElement::set_position( Tform); CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _TrapCenter = gcen; } // // position_child_at // bool GenTrapezoid::position_child_at( const CartesianCoordinate& lpt, GeometryElement& kid) { GeometryXform gxf = local_to_xform(lpt); GeometryXform gxf1 = get_position().apply(gxf); kid.set_position(gxf1); return true; } bool GenTrapezoid::position_child_at( const GeometryXform& lpt, GeometryElement& kid) { GeometryXform gxf = get_position().apply(lpt); kid.set_position(gxf); return true; }