AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BIH::BuildStats Class Reference

#include "BoundingIntervalHierarchy.h"

Public Member Functions

 BuildStats ()
 
void updateInner ()
 
void updateBVH2 ()
 
void updateLeaf (int depth, int n)
 
void printStats ()
 

Private Attributes

int numNodes {0}
 
int numLeaves {0}
 
int sumObjects {0}
 
int minObjects {0x0FFFFFFF}
 
int maxObjects {-1}
 
int sumDepth {0}
 
int minDepth {0x0FFFFFFF}
 
int maxDepth {-1}
 
int numLeavesN [6]
 
int numBVH2 {0}
 

Detailed Description

Constructor & Destructor Documentation

◆ BuildStats()

BIH::BuildStats::BuildStats ( )
inline
413 {
414 for (int& i : numLeavesN) { i = 0; }
415 }
int numLeavesN[6]
Definition: BoundingIntervalHierarchy.h:408

References numLeavesN.

Member Function Documentation

◆ printStats()

void BIH::BuildStats::printStats ( )
318{
319 printf("Tree stats:\n");
320 printf(" * Nodes: %d\n", numNodes);
321 printf(" * Leaves: %d\n", numLeaves);
322 printf(" * Objects: min %d\n", minObjects);
323 printf(" avg %.2f\n", (float) sumObjects / numLeaves);
324 printf(" avg(n>0) %.2f\n", (float) sumObjects / (numLeaves - numLeavesN[0]));
325 printf(" max %d\n", maxObjects);
326 printf(" * Depth: min %d\n", minDepth);
327 printf(" avg %.2f\n", (float) sumDepth / numLeaves);
328 printf(" max %d\n", maxDepth);
329 printf(" * Leaves w/: N=0 %3d%%\n", 100 * numLeavesN[0] / numLeaves);
330 printf(" N=1 %3d%%\n", 100 * numLeavesN[1] / numLeaves);
331 printf(" N=2 %3d%%\n", 100 * numLeavesN[2] / numLeaves);
332 printf(" N=3 %3d%%\n", 100 * numLeavesN[3] / numLeaves);
333 printf(" N=4 %3d%%\n", 100 * numLeavesN[4] / numLeaves);
334 printf(" N>4 %3d%%\n", 100 * numLeavesN[5] / numLeaves);
335 printf(" * BVH2 nodes: %d (%3d%%)\n", numBVH2, 100 * numBVH2 / (numNodes + numLeaves - 2 * numBVH2));
336}
int minObjects
Definition: BoundingIntervalHierarchy.h:403
int sumDepth
Definition: BoundingIntervalHierarchy.h:405
int numBVH2
Definition: BoundingIntervalHierarchy.h:409
int numLeaves
Definition: BoundingIntervalHierarchy.h:401
int sumObjects
Definition: BoundingIntervalHierarchy.h:402
int maxDepth
Definition: BoundingIntervalHierarchy.h:407
int minDepth
Definition: BoundingIntervalHierarchy.h:406
int maxObjects
Definition: BoundingIntervalHierarchy.h:404
int numNodes
Definition: BoundingIntervalHierarchy.h:400

Referenced by BIH::build().

◆ updateBVH2()

void BIH::BuildStats::updateBVH2 ( )
inline
418{ numBVH2++; }

References numBVH2.

Referenced by BIH::subdivide().

◆ updateInner()

void BIH::BuildStats::updateInner ( )
inline
417{ numNodes++; }

References numNodes.

Referenced by BIH::subdivide().

◆ updateLeaf()

void BIH::BuildStats::updateLeaf ( int  depth,
int  n 
)
305{
306 numLeaves++;
307 minDepth = std::min(depth, minDepth);
308 maxDepth = std::max(depth, maxDepth);
309 sumDepth += depth;
310 minObjects = std::min(n, minObjects);
311 maxObjects = std::max(n, maxObjects);
312 sumObjects += n;
313 int nl = std::min(n, 5);
314 ++numLeavesN[nl];
315}

References maxDepth, maxObjects, minDepth, minObjects, numLeaves, numLeavesN, sumDepth, and sumObjects.

Referenced by BIH::subdivide().

Member Data Documentation

◆ maxDepth

int BIH::BuildStats::maxDepth {-1}
private

Referenced by updateLeaf().

◆ maxObjects

int BIH::BuildStats::maxObjects {-1}
private

Referenced by updateLeaf().

◆ minDepth

int BIH::BuildStats::minDepth {0x0FFFFFFF}
private

Referenced by updateLeaf().

◆ minObjects

int BIH::BuildStats::minObjects {0x0FFFFFFF}
private

Referenced by updateLeaf().

◆ numBVH2

int BIH::BuildStats::numBVH2 {0}
private

Referenced by updateBVH2().

◆ numLeaves

int BIH::BuildStats::numLeaves {0}
private

Referenced by updateLeaf().

◆ numLeavesN

int BIH::BuildStats::numLeavesN[6]
private

Referenced by BuildStats(), and updateLeaf().

◆ numNodes

int BIH::BuildStats::numNodes {0}
private

Referenced by updateInner().

◆ sumDepth

int BIH::BuildStats::sumDepth {0}
private

Referenced by updateLeaf().

◆ sumObjects

int BIH::BuildStats::sumObjects {0}
private

Referenced by updateLeaf().