Loading LrRay.cpp 0 → 100644 +120 −0 Original line number Diff line number Diff line #if defined HAVE_CONFIG_H #include "config.h" #endif /***************************************************************************** * class LrRay : Cette structure représente le rayon * * qui est défini par une direction de type LrVector, * * et un point d'origine de type LrPoint. * * * * author : J.Francois, M.Nauge, A.Richard, H.Souchaud, E.Vershuur * * creation : Thursday, February 14 2008 (2/14/2008) * * note : * *****************************************************************************/ #include "LrRay.h" /*---------------------------------------------------------------------------* * constructors and destructor * *---------------------------------------------------------------------------*/ LrRay::LrRay() : m_direction(), m_origin() { } LrRay::LrRay(const LrRay &source) : m_direction(source.m_direction), m_origin(source.m_origin) { } LrRay * LrRay::clone() const { return new LrRay(*this); } LrRay::LrRay(const LrVector &direction, const LrPoint &origin) : m_direction(direction), m_origin(origin) { } LrRay::~LrRay() { } /*---------------------------------------------------------------------------* * assignement operator(s) * *---------------------------------------------------------------------------*/ LrRay & LrRay::operator = (const LrRay &source) { if (this == &source) return *this; m_direction = source.m_direction; m_origin = source.m_origin; return *this; } /*---------------------------------------------------------------------------* * comparison operator(s) * *---------------------------------------------------------------------------*/ bool operator == (const LrRay &lhs, const LrRay &rhs) { return (lhs.m_direction == rhs.m_direction) && (lhs.m_origin == rhs.m_origin); } bool operator != (const LrRay &lhs, const LrRay &rhs) { return (! (lhs == rhs)); } /*---------------------------------------------------------------------------* * accessors * *---------------------------------------------------------------------------*/ LrVector LrRay::getDirection() const { return m_direction; } void LrRay::setDirection(const LrVector &direction) { m_direction = direction; } LrPoint LrRay::getOrigin() const { return m_origin; } void LrRay::setOrigin(const LrPoint &origin) { m_origin = origin; } //obtenir les coordonées du point situe a une distance k LrPoint LrRay::getPoint(REAL distanceK) { //Pres = Porigine + K*V LrPoint Pres(m_origin.translate + (distanceK*m_direction)); return Pres; } LrRay.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /***************************************************************************** * class LrRay : Cette structure représente le rayon * * qui est défini par une direction de type LrVector, * * et un point d'origine de type LrPoint. * * * * author : J.Francois, M.Nauge, A.Richard, H.Souchaud, E.Vershuur * * creation : Thursday, February 14 2008 (2/14/2008) * * note : * *---------------------------------------------------------------------------* * $Id$ *---------------------------------------------------------------------------* * Log : see end of file * *****************************************************************************/ #ifndef LRRAY_H #define LRRAY_H #include "LrVector.h" #include "LrPoint.h" class LrRay { public: // constructors and destructor // *************************** LrRay(); LrRay(const LrRay &source); LrRay * clone() const; LrRay(const LrVector &direction, const LrPoint &origin); virtual ~LrRay(); // assignement operator(s) // *********************** LrRay & operator = (const LrRay &source); // comparison operator(s) // ********************** friend bool operator == (const LrRay &lhs, const LrRay &rhs); friend bool operator != (const LrRay &lhs, const LrRay &rhs); // accessors // ********* LrVector getDirection() const; void setDirection(const LrVector &direction); LrPoint getOrigin() const; void setOrigin(const LrPoint &origin); //obtenir les coordonées du point situe a une distance k LrPoint getPoint(REAL distanceK); private: // data // **** LrVector m_direction; LrPoint m_origin; }; #endif /***************************************************************************** * $Log$ *****************************************************************************/ Loading
LrRay.cpp 0 → 100644 +120 −0 Original line number Diff line number Diff line #if defined HAVE_CONFIG_H #include "config.h" #endif /***************************************************************************** * class LrRay : Cette structure représente le rayon * * qui est défini par une direction de type LrVector, * * et un point d'origine de type LrPoint. * * * * author : J.Francois, M.Nauge, A.Richard, H.Souchaud, E.Vershuur * * creation : Thursday, February 14 2008 (2/14/2008) * * note : * *****************************************************************************/ #include "LrRay.h" /*---------------------------------------------------------------------------* * constructors and destructor * *---------------------------------------------------------------------------*/ LrRay::LrRay() : m_direction(), m_origin() { } LrRay::LrRay(const LrRay &source) : m_direction(source.m_direction), m_origin(source.m_origin) { } LrRay * LrRay::clone() const { return new LrRay(*this); } LrRay::LrRay(const LrVector &direction, const LrPoint &origin) : m_direction(direction), m_origin(origin) { } LrRay::~LrRay() { } /*---------------------------------------------------------------------------* * assignement operator(s) * *---------------------------------------------------------------------------*/ LrRay & LrRay::operator = (const LrRay &source) { if (this == &source) return *this; m_direction = source.m_direction; m_origin = source.m_origin; return *this; } /*---------------------------------------------------------------------------* * comparison operator(s) * *---------------------------------------------------------------------------*/ bool operator == (const LrRay &lhs, const LrRay &rhs) { return (lhs.m_direction == rhs.m_direction) && (lhs.m_origin == rhs.m_origin); } bool operator != (const LrRay &lhs, const LrRay &rhs) { return (! (lhs == rhs)); } /*---------------------------------------------------------------------------* * accessors * *---------------------------------------------------------------------------*/ LrVector LrRay::getDirection() const { return m_direction; } void LrRay::setDirection(const LrVector &direction) { m_direction = direction; } LrPoint LrRay::getOrigin() const { return m_origin; } void LrRay::setOrigin(const LrPoint &origin) { m_origin = origin; } //obtenir les coordonées du point situe a une distance k LrPoint LrRay::getPoint(REAL distanceK) { //Pres = Porigine + K*V LrPoint Pres(m_origin.translate + (distanceK*m_direction)); return Pres; }
LrRay.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /***************************************************************************** * class LrRay : Cette structure représente le rayon * * qui est défini par une direction de type LrVector, * * et un point d'origine de type LrPoint. * * * * author : J.Francois, M.Nauge, A.Richard, H.Souchaud, E.Vershuur * * creation : Thursday, February 14 2008 (2/14/2008) * * note : * *---------------------------------------------------------------------------* * $Id$ *---------------------------------------------------------------------------* * Log : see end of file * *****************************************************************************/ #ifndef LRRAY_H #define LRRAY_H #include "LrVector.h" #include "LrPoint.h" class LrRay { public: // constructors and destructor // *************************** LrRay(); LrRay(const LrRay &source); LrRay * clone() const; LrRay(const LrVector &direction, const LrPoint &origin); virtual ~LrRay(); // assignement operator(s) // *********************** LrRay & operator = (const LrRay &source); // comparison operator(s) // ********************** friend bool operator == (const LrRay &lhs, const LrRay &rhs); friend bool operator != (const LrRay &lhs, const LrRay &rhs); // accessors // ********* LrVector getDirection() const; void setDirection(const LrVector &direction); LrPoint getOrigin() const; void setOrigin(const LrPoint &origin); //obtenir les coordonées du point situe a une distance k LrPoint getPoint(REAL distanceK); private: // data // **** LrVector m_direction; LrPoint m_origin; }; #endif /***************************************************************************** * $Log$ *****************************************************************************/