commit e06a78df824abd831cd68361045f5255b5a771fb
parent 82e6587822898b47ee07aeb4cdbca99e670e4159
Author: Yoann <yoann.b87@voila.fr>
Date: Wed, 18 Jan 2012 18:17:08 +0100
Ajout de booléens pour détection des maison complètement encerclées.
Diffstat:
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/rules/architecture/batiment.cpp b/rules/architecture/batiment.cpp
@@ -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));
}
diff --git a/rules/architecture/batiment.hh b/rules/architecture/batiment.hh
@@ -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();