Test et correction des structures de données pour le découpage des bâtiments.

This commit is contained in:
Georges Dupéron 2012-01-17 23:58:36 +01:00
parent 9d6dd26e2c
commit b5f90a796e
2 changed files with 29 additions and 2 deletions

View File

@ -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;
}

View File

@ -42,6 +42,7 @@ private:
std::map<float, WallVertex*>::iterator it;
bool reverse;
public:
MasterWallIterator() : it(), reverse(false) {};
MasterWallIterator(std::map<float, WallVertex*>::iterator mwit) : it(mwit), reverse(false) {};
MasterWallIterator(std::map<float, WallVertex*>::iterator mwit, bool _reverse) : it(mwit), reverse(_reverse) {};
MasterWallIterator(std::map<float, WallVertex*>::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