//============================================================================= // // File: TubularSection.cpp // Created: 19-JAN-1998 by Stephen Kahn // Purpose: provide TubularSection methods // //============================================================================ #include #include #include using namespace dgs; // // local_to_global // SpacePoint TubularSection::local_to_global(const CartesianCoordinate& lpt) const { return GeometryElement::local_to_global( lpt); } // // global_to_local // CartesianCoordinate TubularSection::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 Tube to its local cartesian coordinates // CartesianCoordinate TubularSection::xform_to_local(const GeometryXform& xf) const { CartesianCoordinate lxyz( xf[0], xf[1], xf[2]); return lxyz; } // // local_to_xform // GeometryXform TubularSection::local_to_xform(const CartesianCoordinate& lpt) const { return GeometryXform(lpt.x(),lpt.y(),lpt.z(),0.,0.,0.); } // // set_center_xyz // void TubularSection::set_center_xyz( const double xx, const double yy, const double zz) { CartesianCoordinate center( xx, yy, zz); _Tube_Section_Ctr = center; } void TubularSection::set_center_xyz() { CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _Tube_Section_Ctr = gcen; } // // set_Xform // void TubularSection::set_Xform( const double xx, const double yy, const double zz, const double phie) { GeometryXform Tform( xx, yy, zz, 0., 0., -phie); GeometryElement::set_position( Tform); CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _Tube_Section_Ctr = gcen; } // // fill_TubularSection // void TubularSection::fill_TubularSection( const double dz, const double ri, const double ro, const double phi1, const double phi2) { _phi_lower = phi1; _phi_upper = phi2; fill_TubularShell( dz, ri, ro); } // // position_child_at // bool TubularSection::position_child_at( const CartesianCoordinate& lpt, GeometryElement& kid) { GeometryXform gxf = local_to_xform(lpt); gxf = get_position().apply(gxf); kid.set_position(gxf); return true; } bool TubularSection::position_child_at( const GeometryXform& lpt, GeometryElement& kid) { GeometryXform gxf = get_position().apply( lpt); kid.set_position(gxf); return true; }