#ifndef __DRCSURFPOLYSPHERE_H__ #define __DRCSURFPOLYSPHERE_H__ /*! \brief Representation of a spherical surface limited by a polygon made up by points. The radius of the sphere can be given. The spherical surface is defined as follows: The sphere is a half sphere centered at the coordinate origin (0,0,0) with a radius. \image html DrcSurfPolySphere.png The borders of the sphere are defined by a projection on the x-y plane. This projection is defined by a polygone with points which you can add. \sa addPoint The z-components of these points have to be zero. Such defined, the spherical surface can be positioned and rotated by \sa shift \sa rotate The rotation is performed before the shift operation. */ class DrcSurfPolySphere : public DrcSurfPolyFlat { private: //! The radius of the sphere. double m_radius; //! Flag if dimensions are checked. mutable bool m_checked; //! Transform Transform3D m_trans; //! Inverse transform Transform3D m_transInv; private: /*! \brief Auxiliary function for assignment operator and copy constructor.. \param s The object to copy. */ void copy(const DrcSurfPolySphere& s); /*! \brief Check dimensions of spherical surface. The radius has to be given and the points of the polygon have to be such that the projection is within the half sphere. /return true if ok. */ bool check() const; public: DrcSurfPolySphere(); //!< Empty constructor. /*! \brief Copy constructor. \param s Object to copy. */ DrcSurfPolySphere(const DrcSurfPolySphere& s); /*! \brief Assignment operator. \param s Object to assign. */ DrcSurfPolySphere& operator=(const DrcSurfPolySphere& s); virtual ~DrcSurfPolySphere(){}; /*! \brief Set the radius of the sphere. \param radius The radius [mm] */ void setRadius(double radius){m_radius=radius;}; /*! Point limiting the sphere. The spheres construction points are not the same as the limiting points of the sphere itself. This function returns the limiting points. \param i Index of point starting with 0 \return The point. */ XYZPoint limitingPoint(unsigned int i); /*! Center point of the surface. Like the /sa limitingPoint this function returns the point on the z-axis at construction after applying transformations. \return The transformed center point. */ XYZPoint centerPoint(); // implemetation of pure virtual functions. virtual DrcSurfPolySphere* clone() const; XYZVector normal(const XYZPoint& point) const; bool surfaceHit(DrcPhoton& ph, XYZPoint& pos_new, double& path_length) const; void print(fstream& stream) const; void addTransform(const Transform3D& trans); virtual bool isFlat(){return false;}; }; #endif