Loading LrBinder.cpp 0 → 100644 +55 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente un octree pour la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'un octree */ #if defined HAVE_CONFIG_H #include "config.h" #endif #include "LrBinder.h" LrBinder::LrBinder() : m_liste_objets(), m_globalOctree(NULL) { } LrBinder::LrBinder(const LrBinder & source) : m_liste_objets(source.m_liste_objets), m_globalOctree(source.m_globalOctree) { } LrBinder::LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille) : m_liste_objets(l), m_globalOctree(new LrOctree(NULL, pos_init, taille.getNorme())) { } ~LrBinder() { } void LrBinder::initBinder() { } void LrBinder::createSubdiv(LrOctree &oct, Real taille) { for(int i=0; i < 8; i++) { oct.addOctree(new LrOctree(*this, } } LrBinder.h 0 → 100644 +43 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'une structure acceleratrice pour la gestion des objets 3D */ #ifndef LRBINDER_H #define LRBINDER_H #include "LrOctree.h" #include "LrVecteur.h" #include "LrObject.h" #define MAX_DIV 4 class LrBinder { private : LISTE_OBJETS m_liste_objets;//la liste d'objet LrOctree *m_globalOctree; //un pointer sur la boite englobante principale public : typedef list<LrObject *> LISTE_OBJETS; LrBinder(); LrBinder(const LrBinder & source); LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille); virtual ~LrBinder(); void initBinder(int subdivision);//creation de la structure accélatrice type Grille reguliere }; #endif No newline at end of file LrMatrix.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -147,19 +147,19 @@ operator * (const LrMatrix &lhs, const LrMatrix &rhs) return result; } LrPoint3d operator * (const LrMatrix &lhs, const LrPoint3d &rhs) LrPoint operator * (const LrMatrix &lhs, const LrPoint &rhs) { return LrPoint3d( return LrPoint( lhs.m11 * rhs.x + lhs.m12 * rhs.y + lhs.m13 * rhs.z + lhs.m14, lhs.m21 * rhs.x + lhs.m22 * rhs.y + lhs.m23 * rhs.z + lhs.m24, lhs.m31 * rhs.x + lhs.m32 * rhs.y + lhs.m33 * rhs.z + lhs.m34); } LrVector3d operator * (const LrMatrix &lhs, const LrVector3d &rhs) LrVector operator * (const LrMatrix &lhs, const LrVector &rhs) { return LrVector3d( return LrVector( lhs.m11 * rhs.x + lhs.m12 * rhs.y + lhs.m13 * rhs.z, lhs.m21 * rhs.x + lhs.m22 * rhs.y + lhs.m23 * rhs.z, lhs.m31 * rhs.x + lhs.m32 * rhs.y + lhs.m33 * rhs.z); Loading Loading @@ -221,7 +221,7 @@ LrMatrix::scale(Real scaleX, Real scaleY, Real scaleZ) } LrMatrix LrMatrix::translate(const LrVector3d &v) LrMatrix::translate(const LrVector &v) { return LrMatrix(1.0, 0.0, 0.0, v.x, 0.0, 1.0, 0.0, v.y, Loading Loading @@ -271,7 +271,7 @@ LrMatrix::rotateZ(Real cosinus, Real sinus) } LrMatrix LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, LrMatrix::rotate(const LrPoint ¢er, const LrVector &axis, Real angle) { return rotate(center, axis, cos(angle), sin(angle)); Loading @@ -279,8 +279,8 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, /* * soient O' le point de la droite (i.e. center) * O l'origine du repre * (phi, theta) les coordonnes polaires de axis * O l'origine du rep�re * (phi, theta) les coordonn�es polaires de axis * phi : angle entre Ox et la projection de axis sur Oxy * theta : angle entre 0z et axis * c = cosinus Loading @@ -303,10 +303,10 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, * et donc il faut multiplier les matrices dans l'autre sens */ LrMatrix LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, LrMatrix::rotate(const LrPoint ¢er, const LrVector &axis, Real cosinus, Real sinus) { LrVector3d a = axis; LrVector a = axis; a.normalize(); Real x = a.x; Loading @@ -315,20 +315,20 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, Real c = cosinus; Real s = sinus; LrMatrix TtoO = translate(LrVector3d(center, LrPoint3d::ZERO)); LrMatrix TtoO = translate(LrVector(center, LrPoint::ZERO)); LrMatrix R(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s, 0.0, x*y*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s, 0.0, x*z*(1-c)-y*s, y*z*(1-c)+x*s, z*z*(1-c)+c, 0.0); LrMatrix TfromO = translate(LrVector3d(LrPoint3d::ZERO, center)); LrMatrix TfromO = translate(LrVector(LrPoint::ZERO, center)); return TfromO * R * TtoO; } LrMatrix LrMatrix::frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, const LrVector3d &v1, const LrVector3d &w1, const LrPoint3d &o2, const LrVector3d &u2, const LrVector3d &v2, const LrVector3d &w2) LrMatrix::frameToFrame(const LrPoint &o1, const LrVector &u1, const LrVector &v1, const LrVector &w1, const LrPoint &o2, const LrVector &u2, const LrVector &v2, const LrVector &w2) { LrMatrix F1toF(u1.x, v1.x, w1.x, o1.x, u1.y, v1.y, w1.y, o1.y, Loading @@ -342,11 +342,11 @@ LrMatrix::frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, } LrMatrix LrMatrix::projectOnPlane(const LrPoint3d &o, const LrVector3d &normal) LrMatrix::projectOnPlane(const LrPoint &o, const LrVector &normal) { LrVector3d n = normal; LrVector n = normal; n.normalize(); Real prod = LrVector3d(LrPoint3d::ZERO, o) * n; Real prod = LrVector(LrPoint::ZERO, o) * n; return LrMatrix(1-n.x*n.x, -n.x*n.y, -n.x*n.z, n.x*prod, -n.x*n.y, 1-n.y*n.y, -n.y*n.z, n.y*prod, Loading @@ -354,11 +354,11 @@ LrMatrix::projectOnPlane(const LrPoint3d &o, const LrVector3d &normal) } LrMatrix LrMatrix::projectOnLine(const LrPoint3d &o, const LrVector3d &direction) LrMatrix::projectOnLine(const LrPoint &o, const LrVector &direction) { LrVector3d d = direction; LrVector d = direction; d.normalize(); Real prod = LrVector3d(LrPoint3d::ZERO, o) * d; Real prod = LrVector(LrPoint::ZERO, o) * d; return LrMatrix(d.x*d.x, d.x*d.y, d.x*d.z, o.x-d.x*prod, d.x*d.y, d.y*d.y, d.y*d.z, o.y-d.y*prod, Loading LrMatrix.h +15 −15 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ #ifndef LRMATRIX_H #define LRMATRIX_H #include "LrPoint3d.h" #include "LrVector3d.h" #include "LrPoint.h" #include "LrVector.h" class LrMatrix { Loading Loading @@ -52,8 +52,8 @@ public: // ************************** friend LrMatrix operator * (const LrMatrix &lhs, const LrMatrix &rhs); friend LrPoint3d operator * (const LrMatrix &lhs, const LrPoint3d &rhs); friend LrVector3d operator * (const LrMatrix &lhs, const LrVector3d &rhs); friend LrPoint operator * (const LrMatrix &lhs, const LrPoint &rhs); friend LrVector operator * (const LrMatrix &lhs, const LrVector &rhs); // inverse matrix // ************** Loading @@ -67,7 +67,7 @@ public: static LrMatrix scale(Real scaleXYZ); static LrMatrix scale(Real scaleX, Real scaleY, Real scaleZ); static LrMatrix translate(const LrVector3d &v); static LrMatrix translate(const LrVector &v); static LrMatrix rotateX(Real angle); static LrMatrix rotateX(Real cosinus, Real sinus); Loading @@ -75,20 +75,20 @@ public: static LrMatrix rotateY(Real cosinus, Real sinus); static LrMatrix rotateZ(Real angle); static LrMatrix rotateZ(Real cosinus, Real sinus); static LrMatrix rotate(const LrPoint3d ¢er, const LrVector3d &axis, static LrMatrix rotate(const LrPoint ¢er, const LrVector &axis, Real angle); static LrMatrix rotate(const LrPoint3d ¢er, const LrVector3d &axis, static LrMatrix rotate(const LrPoint ¢er, const LrVector &axis, Real cosinus, Real sinus); static LrMatrix frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, const LrVector3d &v1, const LrVector3d &w1, const LrPoint3d &o2, const LrVector3d &u2, const LrVector3d &v2, const LrVector3d &w2); static LrMatrix frameToFrame(const LrPoint &o1, const LrVector &u1, const LrVector &v1, const LrVector &w1, const LrPoint &o2, const LrVector &u2, const LrVector &v2, const LrVector &w2); static LrMatrix projectOnPlane(const LrPoint3d &o, const LrVector3d &normal); static LrMatrix projectOnLine(const LrPoint3d &o, const LrVector3d &direction); static LrMatrix projectOnPlane(const LrPoint &o, const LrVector &normal); static LrMatrix projectOnLine(const LrPoint &o, const LrVector &direction); // accessors // ********* Loading LrOctree.cpp 0 → 100644 +191 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente un octree pour la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'un octree */ #if defined HAVE_CONFIG_H #include "config.h" #endif #include "LrOctree.h" /*---------------------------------------------------------------------------* * constructors and destructor * *---------------------------------------------------------------------------*/ LrOctree::LrOctree() : m_parent(NULL), m_pos(), m_taille(), m_listeObj(), m_listeOct() { m_listeOct.resize(8); } LrOctree::LrOctree(const LrOctree &source) : m_parent(source.m_parent), m_pos(source.m_pos), m_taille(source.m_taille), m_listeObj(source.m_listeObj), m_listeOct(source.m_listeOct) { } LrOctree * LrOctree::clone() const { return new LrOctree(*this); } LrOctree::LrOctree(const LrOctree &parent, const LrVector &pos, const Real &taille) : m_parent(&parent), m_pos(pos), m_taille(taille) { m_listeOct.resize(8); } LrOctree::~LrOctree() { } /*---------------------------------------------------------------------------* * assignement operator(s) * *---------------------------------------------------------------------------*/ LrOctree & LrOctree::operator = (const LrOctree &source) { if (this == &source) return *this; m_parent = source.m_parent; m_pos = source.m_pos; m_taille = source.m_taille; m_listeObj = source.m_listeObj; m_listeOct = source.m_listeOct; return *this; } /*---------------------------------------------------------------------------* * comparison operator(s) * *---------------------------------------------------------------------------*/ bool operator == (const LrOctree &lhs, const LrOctree &rhs) { bool res = ((*(lhs.m_parent)) == (*(rhs.m_parent))) && (lhs.m_pos == rhs.m_pos) && (lhs.m_taille == rhs.m_taille); if((lhs.m_listeObj.size() != rhs.m_listeObj.size()) || (lhs.m_listeOct.size() != rhs.m_listeOct.size())) return false; list<LrObject *>::iterator itObj_rhs = ((LrOctree &)rhs).m_listeObj.begin(); for(list<LrObject *>::iterator itObj_lhs = ((LrOctree &)lhs).m_listeObj.begin(); itObj_lhs != lhs.m_listeObj.end(); itObj_lhs++) { res = res && (*itObj_lhs == *itObj_rhs); itObj_rhs++; } list<LrOctree *>::iterator itOct_rhs = ((LrOctree &)rhs).m_listeOct.begin(); list<LrOctree *>::iterator itOct_lhs; for( itOct_lhs = ((LrOctree &)lhs).m_listeOct.begin(); itOct_lhs != lhs.m_listeOct.end(); itOct_lhs++) { res = res && (*itOct_lhs == *itOct_rhs); itOct_rhs++; } return res; } bool operator != (const LrOctree &lhs, const LrOctree &rhs) { return (! (lhs == rhs)); } /*---------------------------------------------------------------------------* * accessors * *---------------------------------------------------------------------------*/ const LrOctree* LrOctree::getParent() const { return m_parent; } void LrOctree::setParent(const LrOctree &parent) { m_parent = &parent; } LrVector LrOctree::getPos() const { return m_pos; } void LrOctree::setPos(const LrVector &pos) { m_pos = pos; } Real LrOctree::getTaille() const { return m_taille; } void LrOctree::setTaille(const Real &taille) { m_taille = taille; } const LrOctree* LrOctree::getOctree(int index) const { if(index < 8) { list<LrOctree *>::iterator it = ((LrOctree *)this)->m_listeOct.begin(); int i = 0; while(i !=index) it++; return *it; } } void LrOctree::addOctree(LrOctree *oct) { if(m_listeOct.size() != 8) m_listeOct.push_back(oct); } void LrOctree::addObjet (LrObject *obj) { m_listeObj.push_back(obj); } LrObject* LrOctree::getObject(int index) const { if(index < m_listeObj.size()) { list<LrObject *>::iterator it = ((LrOctree *)this)->m_listeObj.begin(); int i = 0; while(i !=index) it++; return *it; } } Loading
LrBinder.cpp 0 → 100644 +55 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente un octree pour la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'un octree */ #if defined HAVE_CONFIG_H #include "config.h" #endif #include "LrBinder.h" LrBinder::LrBinder() : m_liste_objets(), m_globalOctree(NULL) { } LrBinder::LrBinder(const LrBinder & source) : m_liste_objets(source.m_liste_objets), m_globalOctree(source.m_globalOctree) { } LrBinder::LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille) : m_liste_objets(l), m_globalOctree(new LrOctree(NULL, pos_init, taille.getNorme())) { } ~LrBinder() { } void LrBinder::initBinder() { } void LrBinder::createSubdiv(LrOctree &oct, Real taille) { for(int i=0; i < 8; i++) { oct.addOctree(new LrOctree(*this, } }
LrBinder.h 0 → 100644 +43 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'une structure acceleratrice pour la gestion des objets 3D */ #ifndef LRBINDER_H #define LRBINDER_H #include "LrOctree.h" #include "LrVecteur.h" #include "LrObject.h" #define MAX_DIV 4 class LrBinder { private : LISTE_OBJETS m_liste_objets;//la liste d'objet LrOctree *m_globalOctree; //un pointer sur la boite englobante principale public : typedef list<LrObject *> LISTE_OBJETS; LrBinder(); LrBinder(const LrBinder & source); LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille); virtual ~LrBinder(); void initBinder(int subdivision);//creation de la structure accélatrice type Grille reguliere }; #endif No newline at end of file
LrMatrix.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -147,19 +147,19 @@ operator * (const LrMatrix &lhs, const LrMatrix &rhs) return result; } LrPoint3d operator * (const LrMatrix &lhs, const LrPoint3d &rhs) LrPoint operator * (const LrMatrix &lhs, const LrPoint &rhs) { return LrPoint3d( return LrPoint( lhs.m11 * rhs.x + lhs.m12 * rhs.y + lhs.m13 * rhs.z + lhs.m14, lhs.m21 * rhs.x + lhs.m22 * rhs.y + lhs.m23 * rhs.z + lhs.m24, lhs.m31 * rhs.x + lhs.m32 * rhs.y + lhs.m33 * rhs.z + lhs.m34); } LrVector3d operator * (const LrMatrix &lhs, const LrVector3d &rhs) LrVector operator * (const LrMatrix &lhs, const LrVector &rhs) { return LrVector3d( return LrVector( lhs.m11 * rhs.x + lhs.m12 * rhs.y + lhs.m13 * rhs.z, lhs.m21 * rhs.x + lhs.m22 * rhs.y + lhs.m23 * rhs.z, lhs.m31 * rhs.x + lhs.m32 * rhs.y + lhs.m33 * rhs.z); Loading Loading @@ -221,7 +221,7 @@ LrMatrix::scale(Real scaleX, Real scaleY, Real scaleZ) } LrMatrix LrMatrix::translate(const LrVector3d &v) LrMatrix::translate(const LrVector &v) { return LrMatrix(1.0, 0.0, 0.0, v.x, 0.0, 1.0, 0.0, v.y, Loading Loading @@ -271,7 +271,7 @@ LrMatrix::rotateZ(Real cosinus, Real sinus) } LrMatrix LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, LrMatrix::rotate(const LrPoint ¢er, const LrVector &axis, Real angle) { return rotate(center, axis, cos(angle), sin(angle)); Loading @@ -279,8 +279,8 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, /* * soient O' le point de la droite (i.e. center) * O l'origine du repre * (phi, theta) les coordonnes polaires de axis * O l'origine du rep�re * (phi, theta) les coordonn�es polaires de axis * phi : angle entre Ox et la projection de axis sur Oxy * theta : angle entre 0z et axis * c = cosinus Loading @@ -303,10 +303,10 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, * et donc il faut multiplier les matrices dans l'autre sens */ LrMatrix LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, LrMatrix::rotate(const LrPoint ¢er, const LrVector &axis, Real cosinus, Real sinus) { LrVector3d a = axis; LrVector a = axis; a.normalize(); Real x = a.x; Loading @@ -315,20 +315,20 @@ LrMatrix::rotate(const LrPoint3d ¢er, const LrVector3d &axis, Real c = cosinus; Real s = sinus; LrMatrix TtoO = translate(LrVector3d(center, LrPoint3d::ZERO)); LrMatrix TtoO = translate(LrVector(center, LrPoint::ZERO)); LrMatrix R(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s, 0.0, x*y*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s, 0.0, x*z*(1-c)-y*s, y*z*(1-c)+x*s, z*z*(1-c)+c, 0.0); LrMatrix TfromO = translate(LrVector3d(LrPoint3d::ZERO, center)); LrMatrix TfromO = translate(LrVector(LrPoint::ZERO, center)); return TfromO * R * TtoO; } LrMatrix LrMatrix::frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, const LrVector3d &v1, const LrVector3d &w1, const LrPoint3d &o2, const LrVector3d &u2, const LrVector3d &v2, const LrVector3d &w2) LrMatrix::frameToFrame(const LrPoint &o1, const LrVector &u1, const LrVector &v1, const LrVector &w1, const LrPoint &o2, const LrVector &u2, const LrVector &v2, const LrVector &w2) { LrMatrix F1toF(u1.x, v1.x, w1.x, o1.x, u1.y, v1.y, w1.y, o1.y, Loading @@ -342,11 +342,11 @@ LrMatrix::frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, } LrMatrix LrMatrix::projectOnPlane(const LrPoint3d &o, const LrVector3d &normal) LrMatrix::projectOnPlane(const LrPoint &o, const LrVector &normal) { LrVector3d n = normal; LrVector n = normal; n.normalize(); Real prod = LrVector3d(LrPoint3d::ZERO, o) * n; Real prod = LrVector(LrPoint::ZERO, o) * n; return LrMatrix(1-n.x*n.x, -n.x*n.y, -n.x*n.z, n.x*prod, -n.x*n.y, 1-n.y*n.y, -n.y*n.z, n.y*prod, Loading @@ -354,11 +354,11 @@ LrMatrix::projectOnPlane(const LrPoint3d &o, const LrVector3d &normal) } LrMatrix LrMatrix::projectOnLine(const LrPoint3d &o, const LrVector3d &direction) LrMatrix::projectOnLine(const LrPoint &o, const LrVector &direction) { LrVector3d d = direction; LrVector d = direction; d.normalize(); Real prod = LrVector3d(LrPoint3d::ZERO, o) * d; Real prod = LrVector(LrPoint::ZERO, o) * d; return LrMatrix(d.x*d.x, d.x*d.y, d.x*d.z, o.x-d.x*prod, d.x*d.y, d.y*d.y, d.y*d.z, o.y-d.y*prod, Loading
LrMatrix.h +15 −15 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ #ifndef LRMATRIX_H #define LRMATRIX_H #include "LrPoint3d.h" #include "LrVector3d.h" #include "LrPoint.h" #include "LrVector.h" class LrMatrix { Loading Loading @@ -52,8 +52,8 @@ public: // ************************** friend LrMatrix operator * (const LrMatrix &lhs, const LrMatrix &rhs); friend LrPoint3d operator * (const LrMatrix &lhs, const LrPoint3d &rhs); friend LrVector3d operator * (const LrMatrix &lhs, const LrVector3d &rhs); friend LrPoint operator * (const LrMatrix &lhs, const LrPoint &rhs); friend LrVector operator * (const LrMatrix &lhs, const LrVector &rhs); // inverse matrix // ************** Loading @@ -67,7 +67,7 @@ public: static LrMatrix scale(Real scaleXYZ); static LrMatrix scale(Real scaleX, Real scaleY, Real scaleZ); static LrMatrix translate(const LrVector3d &v); static LrMatrix translate(const LrVector &v); static LrMatrix rotateX(Real angle); static LrMatrix rotateX(Real cosinus, Real sinus); Loading @@ -75,20 +75,20 @@ public: static LrMatrix rotateY(Real cosinus, Real sinus); static LrMatrix rotateZ(Real angle); static LrMatrix rotateZ(Real cosinus, Real sinus); static LrMatrix rotate(const LrPoint3d ¢er, const LrVector3d &axis, static LrMatrix rotate(const LrPoint ¢er, const LrVector &axis, Real angle); static LrMatrix rotate(const LrPoint3d ¢er, const LrVector3d &axis, static LrMatrix rotate(const LrPoint ¢er, const LrVector &axis, Real cosinus, Real sinus); static LrMatrix frameToFrame(const LrPoint3d &o1, const LrVector3d &u1, const LrVector3d &v1, const LrVector3d &w1, const LrPoint3d &o2, const LrVector3d &u2, const LrVector3d &v2, const LrVector3d &w2); static LrMatrix frameToFrame(const LrPoint &o1, const LrVector &u1, const LrVector &v1, const LrVector &w1, const LrPoint &o2, const LrVector &u2, const LrVector &v2, const LrVector &w2); static LrMatrix projectOnPlane(const LrPoint3d &o, const LrVector3d &normal); static LrMatrix projectOnLine(const LrPoint3d &o, const LrVector3d &direction); static LrMatrix projectOnPlane(const LrPoint &o, const LrVector &normal); static LrMatrix projectOnLine(const LrPoint &o, const LrVector &direction); // accessors // ********* Loading
LrOctree.cpp 0 → 100644 +191 −0 Original line number Diff line number Diff line /** * @brief OBJET : represente un octree pour la structure acceleratrice * @file LrOctree.h * @date Lundi 10 Mars 2008 * @note * @author Josselin Francois * @author Michael Nauge * @author Axel Richard * @author Hervé Souchaud * @author Emeric Verschuur * * Ce fichier contient la classe qui gère la creation d'un octree */ #if defined HAVE_CONFIG_H #include "config.h" #endif #include "LrOctree.h" /*---------------------------------------------------------------------------* * constructors and destructor * *---------------------------------------------------------------------------*/ LrOctree::LrOctree() : m_parent(NULL), m_pos(), m_taille(), m_listeObj(), m_listeOct() { m_listeOct.resize(8); } LrOctree::LrOctree(const LrOctree &source) : m_parent(source.m_parent), m_pos(source.m_pos), m_taille(source.m_taille), m_listeObj(source.m_listeObj), m_listeOct(source.m_listeOct) { } LrOctree * LrOctree::clone() const { return new LrOctree(*this); } LrOctree::LrOctree(const LrOctree &parent, const LrVector &pos, const Real &taille) : m_parent(&parent), m_pos(pos), m_taille(taille) { m_listeOct.resize(8); } LrOctree::~LrOctree() { } /*---------------------------------------------------------------------------* * assignement operator(s) * *---------------------------------------------------------------------------*/ LrOctree & LrOctree::operator = (const LrOctree &source) { if (this == &source) return *this; m_parent = source.m_parent; m_pos = source.m_pos; m_taille = source.m_taille; m_listeObj = source.m_listeObj; m_listeOct = source.m_listeOct; return *this; } /*---------------------------------------------------------------------------* * comparison operator(s) * *---------------------------------------------------------------------------*/ bool operator == (const LrOctree &lhs, const LrOctree &rhs) { bool res = ((*(lhs.m_parent)) == (*(rhs.m_parent))) && (lhs.m_pos == rhs.m_pos) && (lhs.m_taille == rhs.m_taille); if((lhs.m_listeObj.size() != rhs.m_listeObj.size()) || (lhs.m_listeOct.size() != rhs.m_listeOct.size())) return false; list<LrObject *>::iterator itObj_rhs = ((LrOctree &)rhs).m_listeObj.begin(); for(list<LrObject *>::iterator itObj_lhs = ((LrOctree &)lhs).m_listeObj.begin(); itObj_lhs != lhs.m_listeObj.end(); itObj_lhs++) { res = res && (*itObj_lhs == *itObj_rhs); itObj_rhs++; } list<LrOctree *>::iterator itOct_rhs = ((LrOctree &)rhs).m_listeOct.begin(); list<LrOctree *>::iterator itOct_lhs; for( itOct_lhs = ((LrOctree &)lhs).m_listeOct.begin(); itOct_lhs != lhs.m_listeOct.end(); itOct_lhs++) { res = res && (*itOct_lhs == *itOct_rhs); itOct_rhs++; } return res; } bool operator != (const LrOctree &lhs, const LrOctree &rhs) { return (! (lhs == rhs)); } /*---------------------------------------------------------------------------* * accessors * *---------------------------------------------------------------------------*/ const LrOctree* LrOctree::getParent() const { return m_parent; } void LrOctree::setParent(const LrOctree &parent) { m_parent = &parent; } LrVector LrOctree::getPos() const { return m_pos; } void LrOctree::setPos(const LrVector &pos) { m_pos = pos; } Real LrOctree::getTaille() const { return m_taille; } void LrOctree::setTaille(const Real &taille) { m_taille = taille; } const LrOctree* LrOctree::getOctree(int index) const { if(index < 8) { list<LrOctree *>::iterator it = ((LrOctree *)this)->m_listeOct.begin(); int i = 0; while(i !=index) it++; return *it; } } void LrOctree::addOctree(LrOctree *oct) { if(m_listeOct.size() != 8) m_listeOct.push_back(oct); } void LrOctree::addObjet (LrObject *obj) { m_listeObj.push_back(obj); } LrObject* LrOctree::getObject(int index) const { if(index < m_listeObj.size()) { list<LrObject *>::iterator it = ((LrOctree *)this)->m_listeObj.begin(); int i = 0; while(i !=index) it++; return *it; } }