www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ea5cc15c7ec5f5b20139d0f5ada56e14aa6bae70
parent cf05e6012ec5d162d92612460f4bbb851a1003ce
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date:   Fri,  6 Jan 2012 20:30:10 +0100

Merge branch 'master' of github:jsmaniac/2011-m2s3-city-builder

Conflicts:
	geometry/quad.hh

Diffstat:
Mgeometry/quad.cpp | 13+++++++++++++
Mgeometry/quad.hh | 1+
Mrules/batiment/batimentquadblock.cpp | 11+++++++++++
Mrules/batiment/batimentquadblock.hh | 1+
4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/geometry/quad.cpp b/geometry/quad.cpp @@ -54,6 +54,19 @@ Quad Quad::makeParallelogram() { return Quad(c[0],c[1],c[2],c[3]); } +float Quad::length(Cardinal cn) { + if(cn == N) + return Segment(c[NW],c[NE]).length(); + else if(cn == S) + return Segment(c[SW],c[SE]).length(); + else if(cn == E) + return Segment(c[NE],c[SE]).length(); + else if(cn == W) + return Segment(c[SW],c[NW]).length(); + + return 0; +} + float Quad::minLengthNS() { return std::min( Segment(c[NW],c[NE]).length(), 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; + float length(Cardinal c); float minLengthNS(); float minLengthEW(); float maxLengthNS(); diff --git a/rules/batiment/batimentquadblock.cpp b/rules/batiment/batimentquadblock.cpp @@ -9,6 +9,17 @@ void BatimentQuadBlock::getBoundingBoxPoints() { addBBPoints(c + Vertex(0,0,height)); // TODO } +bool BatimentQuadBlock::split() { + Quad me = c; + Quad ms = c; + Quad mw = c; + Quad mn = c; + + me[NW] = me[NE] + ((me[NW] - me[NW]) / me.length(N))*150; + //TODO les autres côtés. + return false; +} + void BatimentQuadBlock::triangulation() { addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0); } diff --git a/rules/batiment/batimentquadblock.hh b/rules/batiment/batimentquadblock.hh @@ -11,6 +11,7 @@ class BatimentQuadBlock : public Chose { public : BatimentQuadBlock(Quad c, int height); + virtual bool split(); virtual void triangulation(); virtual void getBoundingBoxPoints(); };