From 3ad78d40ea529fd8857130e49afed280b4eec66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 3 Jan 2012 11:01:47 +0100 Subject: [PATCH] =?UTF-8?q?Ajustement=20de=20la=20taille=20des=20splitBox?= =?UTF-8?q?=20et=20mergeBox=20en=20fonction=20du=20volume=20de=20l'objet?= =?UTF-8?q?=20(pour=20que=20quand=20deux=20objets=20ont=20la=20m=C3=AAme?= =?UTF-8?q?=20taille=20z=20sur=20leur=20AABB,=20le=20z=20de=20la=20splitBo?= =?UTF-8?q?x=20du=20plus=20gros=20soit=20plus=20grand).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bugs/{new => closed}/2011-18-12-1926-reperelocal.txt | 0 rules/chose.cpp | 9 +++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) rename bugs/{new => closed}/2011-18-12-1926-reperelocal.txt (100%) diff --git a/bugs/new/2011-18-12-1926-reperelocal.txt b/bugs/closed/2011-18-12-1926-reperelocal.txt similarity index 100% rename from bugs/new/2011-18-12-1926-reperelocal.txt rename to bugs/closed/2011-18-12-1926-reperelocal.txt diff --git a/rules/chose.cpp b/rules/chose.cpp index ef585ec..e16aac4 100644 --- a/rules/chose.cpp +++ b/rules/chose.cpp @@ -68,9 +68,14 @@ void Chose::addBBPoint(Vertex v) { void Chose::updateAABB() { lod.firstBBPoint = true; getBoundingBoxPoints(); + float dx = lod.aabb[1] - lod.aabb[0]; + float dy = lod.aabb[3] - lod.aabb[2]; + float dz = lod.aabb[5] - lod.aabb[4]; + float volume = dx*dy*dz; + float pseudoLength = std::max(1.f, std::pow(volume, 1.f/3.f) / 1000.f); + float splitFactor = 24 * pseudoLength; + float mergeFactor = 25 * pseudoLength; for (int i = 0; i < 3; i++) { - float splitFactor = 24; - float mergeFactor = 25; float center = (lod.aabb[2*i] + lod.aabb[2*i+1]) / 2; lod.splitBox[2*i] = (lod.aabb[2*i] - center) * splitFactor + center; lod.splitBox[2*i+1] = (lod.aabb[2*i+1] - center) * splitFactor + center;