//============================================================================= // // File: TubularShell.cpp // Created: 27-DEC-1997 by Stephen Kahn // Purpose: provide TubularShell methods // //============================================================================ #include #include #include using namespace dgs; // // local_to_global // SpacePoint TubularShell::local_to_global(const CartesianCoordinate& lpt) const { return GeometryElement::local_to_global( lpt); } // // global_to_local // CartesianCoordinate TubularShell::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 TubularShell::xform_to_local(const GeometryXform& xf) const { CartesianCoordinate lxyz( xf[0], xf[1], xf[2]); return lxyz; } // // local_to_xform // GeometryXform TubularShell::local_to_xform(const CartesianCoordinate& lpt) const { return GeometryXform(lpt.x(),lpt.y(),lpt.z(),0.,0.,0.); } // // set_center_xyz // void TubularShell::set_center_xyz( const double xx, const double yy, const double zz) { CartesianCoordinate center( xx, yy, zz); _TubeCenter = center; } void TubularShell::set_center_xyz() { CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _TubeCenter = gcen; } // // set_Xform // void TubularShell::set_Xform( const double xx, const double yy, const double zz) { GeometryXform Tform( xx, yy, zz, 0., 0., 0.); GeometryElement::set_position( Tform); CartesianCoordinate zero( 0., 0., 0.); SpacePoint gc = local_to_global( zero); CartesianCoordinate gcen( gc.x(), gc.y(), gc.z()); _TubeCenter = gcen; } // // fill_TubularShell // void TubularShell::fill_TubularShell( const double dz, const double ri, const double ro) { _zhalf = dz; _inner_radius = ri; _outer_radius = ro; } // // position_child_at // bool TubularShell::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 TubularShell::position_child_at( const GeometryXform& lpt, GeometryElement& kid) { GeometryXform gxf = get_position().apply(lpt); kid.set_position(gxf); return true; }