//============================================================================= // // File: SlantedTubeSection.cpp // Created: 13-FEB-1998 by Stephen Kahn // Purpose: provide SlantedTubeSection methods // //============================================================================ #include #include #include extern "C" { double hypot(double,double); } using namespace dgs; using namespace std; // // fill_TubularSection // void SlantedTubeSection::fill_SlantedTubeSection( const double dz, const double ri, const double ro, const double phi1, const double phi2, const double slt_ang) { TubularSection::fill_TubularSection( dz, ri, ro, phi1, phi2); _slant_angle = slt_ang; _tan_slant_angle = tan(_slant_angle); } // // zeta_from_cylind // double SlantedTubeSection::zeta_from_cylind( double r, double z) { double rcen; CartesianCoordinate cent; double zeta; cent = get_center(); rcen = hypot( cent.x(), cent.y()); zeta = z - cent.z() + (r - rcen)*_tan_slant_angle; return zeta; } // // local to cartesian // CartesianCoordinate SlantedTubeSection::local_to_cartesian( double r, double zeta, double phi) { double x, y, z; double xl, yl, zl, phic, rcen; CartesianCoordinate cent; cent = get_center(); rcen = hypot( cent.x(), cent.y()); phic = atan2( cent.y(), cent.x()); x = r*cos(phi) - rcen; y = r*sin(phi); z = zeta - (r - rcen)*_tan_slant_angle; xl = x*cos(phic) + y*sin(phic); yl = -x*sin(phic) + y*cos(phic); zl = z - cent.z(); CartesianCoordinate pos( xl, yl, zl); return pos; }