commit 8e916890b0d9a5ba510ac3ec58f2343884f2080e
parent 892e6fb276db42818ce7e5fd315dee071dbb94ee
Author: Yoann <yoann.b87@voila.fr>
Date: Tue, 10 Jan 2012 11:32:52 +0100
Ré-implémentation de la décomposition du block en murs lors des splits.
Diffstat:
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/geometry/quad.hh b/geometry/quad.hh
@@ -27,6 +27,7 @@ class Quad {
Quad inset(Cardinal side, float offset) const;
Quad insetNESW(float offsetN, float offsetE, float offsetS, float offsetW) const;
Quad insetNESW(float offset) const;
+ Quad insetOpp(Cardinal side, float offset) const;
float length(Cardinal side) const;
float minLengthNS() const;
float minLengthEW() const;
diff --git a/rules/batiment/batimentquadblock.cpp b/rules/batiment/batimentquadblock.cpp
@@ -10,21 +10,10 @@ void BatimentQuadBlock::getBoundingBoxPoints() {
}
bool BatimentQuadBlock::split() {
- Quad me = c;
- Quad ms = c;
- Quad mw = c;
- Quad mn = c;
-
- me[NW] = me[NE] + ((me[NW] - me[NE]) / me.length(N))*28;
- me[SW] = me[SE] + ((me[SW] - me[SE]) / me.length(S))*28;
- mw[NE] = mw[NW] + ((mw[NE] - mw[NW]) / mw.length(N))*28;
- mw[SE] = mw[SW] + ((mw[SE] - mw[SW]) / mw.length(S))*28;
- mn.inset(W,-28); mn.inset(E,-28);
- mn[SW] = mn[NW] + ((mn[SW] - mn[NW]) / mn.length(W))*28;
- mn[SE] = mn[NE] + ((mn[SE] - mn[NE]) / mn.length(E))*28;
- ms.inset(W,-28); ms.inset(E,-28);
- ms[NW] = ms[SW] + ((ms[NW] - ms[SW]) / ms.length(W))*28;
- ms[NE] = ms[SE] + ((ms[NE] - ms[SE]) / ms.length(E))*28;
+ Quad me = c.insetOpp(E,28);
+ Quad ms = c.inset(E,-28).inset(W,-28).insetOpp(S,28);
+ Quad mw = c.insetOpp(W,28);
+ Quad mn = c.inset(E,-28).inset(W,-28).insetOpp(N,28);
addChild(new BatimentQuadMur(me,height));
addChild(new BatimentQuadMur(mw,height));