From b5f90a796e732f466035b8f4613cce0300b8c77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 17 Jan 2012 23:58:36 +0100 Subject: [PATCH] =?UTF-8?q?Test=20et=20correction=20des=20structures=20de?= =?UTF-8?q?=20donn=C3=A9es=20pour=20le=20d=C3=A9coupage=20des=20b=C3=A2tim?= =?UTF-8?q?ents.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 26 ++++++++++++++++++++++++++ rules/architecture/batiment.hh | 5 +++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 5418ab4..abe745d 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,32 @@ int main() { c->triangulation(); c->updateAABB(); + WallVertex* wvne = new WallVertex(ne); + WallVertex* wvse = new WallVertex(se); + WallVertex* wvsw = new WallVertex(sw); + WallVertex* wvnw = new WallVertex(nw); + Wall* wn = new Wall(wvnw,wvne); + Wall* we = new Wall(wvne,wvse); + Wall* ws = new Wall(wvse,wvsw); + Wall* ww = new Wall(wvsw,wvnw); + WallVertex* wvn = wn->randomPos(Chose::initialSeed, 0, 1.f/3.f, 2.f/3.f); + WallVertex* wvs = ws->randomPos(Chose::initialSeed, 1, 1.f/3.f, 2.f/3.f); + Wall* cut = new Wall(wvn, wvs); + Wall* cut2 = new Wall(wvn, wvse); + + Wall::iterator it; + for (it = wn->begin(); it != wn->end(); ++it) + std::cout << (Vertex)(*(*it)) << std::endl; + + (void) wn; + (void) we; + (void) ws; + (void) ww; + (void) wvn; + (void) wvs; + (void) cut; + (void) cut2; + new View(c); return 0; } diff --git a/rules/architecture/batiment.hh b/rules/architecture/batiment.hh index 7be367e..c0834b6 100644 --- a/rules/architecture/batiment.hh +++ b/rules/architecture/batiment.hh @@ -42,6 +42,7 @@ private: std::map::iterator it; bool reverse; public: + MasterWallIterator() : it(), reverse(false) {}; MasterWallIterator(std::map::iterator mwit) : it(mwit), reverse(false) {}; MasterWallIterator(std::map::iterator mwit, bool _reverse) : it(mwit), reverse(_reverse) {}; MasterWallIterator(std::map::reverse_iterator mwrit) : it(--(mwrit.base())), reverse(false) {}; @@ -50,7 +51,7 @@ public: bool operator!=(const MasterWallIterator& mwit) const { return it != mwit.it; }; WallVertex* operator*() { return (*it).second; }; WallVertex* operator->() { return (*it).second; }; - virtual void operator++() { if (reverse) it--; else it++; } + virtual MasterWallIterator& operator++() { if (reverse) it--; else it++; return (*this); } }; class MasterWall { @@ -133,7 +134,7 @@ public: }; typedef MasterWall::iterator iterator; iterator begin() { return master->find(uPosOnMasterWall, (uPosOnMasterWall > vPosOnMasterWall)); }; - iterator end() { return master->find(vPosOnMasterWall, (uPosOnMasterWall > vPosOnMasterWall)); }; + iterator end() { return ++(master->find(vPosOnMasterWall, (uPosOnMasterWall > vPosOnMasterWall))); }; }; #endif