KiCad PCB EDA Suite
HLBVH_SAH_Evaluator Struct Reference

Public Member Functions

 HLBVH_SAH_Evaluator (int split, int num, int d, const CBBOX &b)
 
bool operator() (const BVHBuildNode *node) const
 

Public Attributes

int minCostSplitBucket
 
int nBuckets
 
int dim
 
const CBBOXcentroidBounds
 

Detailed Description

Definition at line 407 of file cbvh_pbrt.cpp.

Constructor & Destructor Documentation

HLBVH_SAH_Evaluator::HLBVH_SAH_Evaluator ( int  split,
int  num,
int  d,
const CBBOX b 
)
inline

Definition at line 409 of file cbvh_pbrt.cpp.

References dim, minCostSplitBucket, and nBuckets.

410  : centroidBounds(b)
411  { minCostSplitBucket = split; nBuckets = num; dim = d; }
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:416

Member Function Documentation

bool HLBVH_SAH_Evaluator::operator() ( const BVHBuildNode node) const

Definition at line 420 of file cbvh_pbrt.cpp.

References BVHBuildNode::bounds, centroidBounds, dim, CBBOX::GetCenter(), CBBOX::Max(), CBBOX::Min(), minCostSplitBucket, and nBuckets.

421 {
422  const float centroid = node->bounds.GetCenter( dim );
423 
424  int b = nBuckets *
425  // Computes the offset (0.0 - 1.0) for one axis
426  ( ( centroid - centroidBounds.Min()[dim] ) /
427  ( centroidBounds.Max()[dim] - centroidBounds.Min()[dim] ) );
428 
429  if( b == nBuckets )
430  b = nBuckets - 1;
431 
432  wxASSERT( b >= 0 && b < nBuckets );
433 
434  return b <= minCostSplitBucket;
435 }
const SFVEC3F & Min() const
Function Min return the minimun vertex pointer.
Definition: cbbox.h:205
const SFVEC3F & Max() const
Function Max return the maximum vertex pointer.
Definition: cbbox.h:212
SFVEC3F GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox.cpp:135
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:416

Member Data Documentation

const CBBOX& HLBVH_SAH_Evaluator::centroidBounds

Definition at line 416 of file cbvh_pbrt.cpp.

Referenced by operator()().

int HLBVH_SAH_Evaluator::dim

Definition at line 415 of file cbvh_pbrt.cpp.

Referenced by HLBVH_SAH_Evaluator(), and operator()().

int HLBVH_SAH_Evaluator::minCostSplitBucket

Definition at line 415 of file cbvh_pbrt.cpp.

Referenced by HLBVH_SAH_Evaluator(), and operator()().

int HLBVH_SAH_Evaluator::nBuckets

Definition at line 415 of file cbvh_pbrt.cpp.

Referenced by HLBVH_SAH_Evaluator(), and operator()().


The documentation for this struct was generated from the following file: