#ifndef __DRCSURFQUADFLATDIFF_H__ #define __DRCSURFQUADFLATDIFF_H__ class DrcSurfPolyFlat; /*! \brief Abstract class for flat surface representation, defined by 2 points of one surface and 2 points of another surface. The 4 points have to be within a plane. The purpose of this class is to generate surfaces between one surface and a non flat surface. Eg. the surfaces between a flat surface (one side) and a spherical surface (the other side) to construct the sides of a lens. \image html DrcSurfQuadFlatDiff.png Since you connect to non planar surfaces which are created in an unshifted and unrotated coordinate system, you should generate the difference surface in the same system and rotate the whole construct after the generation. */ class DrcSurfQuadFlatDiff : public DrcSurfAbs { private: //! point of 1st surface XYZPoint m_s1p1; //! point of 1st surface XYZPoint m_s1p2; //! point of 2nd surface XYZPoint m_s2p1; //! point of 2nd surface XYZPoint m_s2p2; //! 1st surface DrcSurfAbs* m_s1; //! 2st surface DrcSurfAbs* m_s2; //! Normal vector XYZVector m_normal; //! Auxiliary surface DrcSurfPolyFlat m_surfAux; /*! \brief Auxiliary function for assignment operator and copy constructor.. \param s The object to copy. */ void copy(const DrcSurfQuadFlatDiff& s); public: //! Empty constructor. DrcSurfQuadFlatDiff(); //! Destructor. virtual ~DrcSurfQuadFlatDiff(); /*! \brief Copy constructor. Since the names of both surfaces are copied, there is the possibilty to set those names. \sa setNameSurface1() \sa setNameSurface2() \param s Object to copy. */ DrcSurfQuadFlatDiff(const DrcSurfQuadFlatDiff& s); /*! \brief Assignment operator. \param s Object to assign. */ DrcSurfQuadFlatDiff& operator=(const DrcSurfQuadFlatDiff& s); /*! \brief Add surface to connect to and 2 points for construction of difference surface. You have to this exatcly twice. The 1st point of the first surface is connected to the 1st point of the second surface. Analog procedure for the 2nd point. \param surf The surface to connect to. \param p1 The 1st point of the surface to connect to. \param p2 The 2nd point of the surface to connect to. \sa DrcSurfPolySphere::limitingPoint \sa DrcSurfPolyPara::limitingPoint */ void addSurface(const DrcSurfAbs& surf, XYZPoint p1, XYZPoint p2); /*! \brief Set the name of the first surface \sa DrcSurfQuadFlatDiff(const DrcSurfQuadFlatDiff&) \param s The name. */ void setNameSurface1(string s){m_s1->setName(s);}; /*! \brief Set the name of the second surface \sa DrcSurfQuadFlatDiff(const DrcSurfQuadFlatDiff&) \param s The name. */ void setNameSurface2(string s){m_s2->setName(s);}; /*! \brief Name of first surface. \return The name. */ string nameSurface1() const {return m_s1->name();}; /*! \brief Name of second surface. \return The name. */ string nameSurface2() const {return m_s2->name();}; // implementation of pure virtual functions. virtual DrcSurfQuadFlatDiff* 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 true;}; }; #endif