Ajout de booléens pour détection des maison complètement encerclées.

This commit is contained in:
Yoann 2012-01-18 18:17:08 +01:00
parent 82e6587822
commit e06a78df82
2 changed files with 17 additions and 6 deletions

View File

@ -1,20 +1,30 @@
#include "all_includes.hh"
BatimentQuad_::BatimentQuad_(Quad _c, bool _isSub) : Chose(), c(_c), isSub(_isSub) {
BatimentQuad_::BatimentQuad_(Quad _c, bool _isSub, bool _we, bool _ws, bool _ww, bool _wn)
: Chose(), c(_c), isSub(_isSub), we(_we), ws(_ws), ww(_ww), wn(_wn) {
addEntropy(c);
}
bool BatimentQuad_::split() {
int minSurface = 100 * 100 * 100;
Quad q = c << c.maxLengthSide();
if(q.surface() > 2 * minSurface) {
Quad q = c;
//Quad q = c << c.maxLengthSide();
if(c.maxLengthNS() < c.maxLengthEW()) {
q = c >> 1;
bool t = we;
we = wn; wn = ww; ww = ws; ws = t;
}
std::cout << "w : " << we << " " << ws << " " << ww << " " << wn << std::endl;
if((we || ws || ww || wn) && q.surface() > 2 * minSurface) {
Vertex n = Segment(q[NW], q[NE]).randomPos(seed, 0, 3.f/8.f, 5.f/8.f);
Vertex s = Segment(q[SE], q[SW]).randomPos(seed, 1, 3.f/8.f, 5.f/8.f);
addChild(new BatimentQuad_(Quad(q[NE], q[SE], s, n), true));
addChild(new BatimentQuad_(Quad(q[SW], q[NW], n, s), true));
addChild(new BatimentQuad_(Quad(q[NE], q[SE], s, n), true,we&&true,ws&&true,false,wn&&true));
addChild(new BatimentQuad_(Quad(q[SW], q[NW], n, s), true,false,ws&&true,ww&&true,wn&&true));
} else {
Quad ch = c.offsetNormal(Dimensions::hauteurEtage);
ch = ch.insetNESW(80);
addChild(new ToitQuad(ch, Dimensions::hauteurToit));
}

View File

@ -6,9 +6,10 @@
class BatimentQuad_ : public Chose {
Quad c;
bool isSub;
bool we, ws, ww, wn;
public:
BatimentQuad_(Quad _c, bool _isSub = false);
BatimentQuad_(Quad _c, bool _isSub=false, bool _we=true, bool _ws=true, bool _ww=true, bool _wn=true);
virtual bool split();
virtual void triangulation();
virtual void getBoundingBoxPoints();