#ifndef CYLINDRICALSURFACE_HH #define CYLINDRICALSURFACE_HH // // $Id: CylindricalSurface.hpp,v 1.16 2001/02/14 22:53:29 russo Exp $ // // File: CylindricalSurface.hh // Purpose: // Created: 13-SEP-1997 John Hobbs // // $Revision: 1.16 $ // // #include "LinearAlgebra/Matrix.h" #include "PhysicsVectors/Rotation.h" #include "d0om/d0_Object.hpp" #include "geometry_system/components/CylindricalCoordinate.hpp" #include "geometry_system/components/CylindricalMatrix.hpp" #include "geometry_system/components/GeometryElement.hpp" #include "geometry_system/components/GeometryXform.hpp" #include "spacegeom/SpacePoint.h" #include #include namespace dgs { class CylindricalSurface : public GeometryElement { // A cylidrical surface. // // A cylindrical surface specified by its radius and z half-length. // The cylinder is oriented with its axis along the z-axis. public: /// Default constructor. CylindricalSurface(); /// Construct cylinder with specified radius and z half-length. CylindricalSurface(const double radius, const double zhalf); /// Convert local point to global one. SpacePoint local_to_global( const CylindricalCoordinate& lpt) const; /// Convert matrix in local cylidrical coordinates to global coordinates MatrixD local_to_global(const CylindricalMatrix& matrix3x3) const; /// Convert global point to local one. CylindricalCoordinate global_to_local(const SpacePoint &gpt) const; /// Resize cylinder by specied change in radius and z half-length. bool resize(const double dr, const double dzhalf); /// Position child surface at specified local point. bool position_child_at(const CylindricalCoordinate& lpt, GeometryElement& kid); /** Set explicitly transformation applied to the child during positioning at the surface. By defalt child is rotated in a such a way that its local z axis becomes perpendicular to the cylindrical surface, so for example objects of class Plane become tangent to the cylindrical surface. */ void set_tangent_Xform(const Rotation & tForm); /// Access radius. double get_radius() const {return _radius;} /// Access z half-length double get_zhalf() const {return _zhalf;} /// Return global coordinate r on cylinder, given global phi, z. double get_r(double phi, double z) const; // comparisons friend bool operator ==(const CylindricalSurface& lhs, const CylindricalSurface& rhs); friend bool operator !=(const CylindricalSurface& lhs, const CylindricalSurface& rhs); friend bool operator <(const CylindricalSurface& lhs, const CylindricalSurface &rhs); /// Get source code version. Kept to allow following code changes const std::string& code_version() const { return _cvers; } /// Stream insertion operator. friend std::ostream& operator<<(std::ostream &os, const CylindricalSurface &me); bool onSurface(const SpacePoint &lpt) const; private: /// Radius. double _radius; /// z half-length. double _zhalf; /// angles defining the tangent direction of the children double _tangang[3]; // Originally "Rotation _tRotation;" not d0omable /// Support for positioning child on surface. CylindricalCoordinate xform_to_local(const GeometryXform &xf) const; /// Support for positioning child on surface. GeometryXform local_to_xform(const CylindricalCoordinate &lpt) const; /// RCS version std::string _cvers; // Replaced at checkout public: D0_OBJECT_SETUP(CylindricalSurface); }; } #endif // CYLINDRICALSURFACE_HH