KiCad PCB EDA Suite
CompareToBucket Struct Reference

Public Member Functions

 CompareToBucket (int split, int num, int d, const CBBOX &b)
 
bool operator() (const BVHPrimitiveInfo &p) const
 

Public Attributes

int splitBucket
 
int nBuckets
 
int dim
 
const CBBOXcentroidBounds
 

Detailed Description

Definition at line 385 of file cbvh_pbrt.cpp.

Constructor & Destructor Documentation

◆ CompareToBucket()

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

Definition at line 387 of file cbvh_pbrt.cpp.

388  : centroidBounds(b)
389  { splitBucket = split; nBuckets = num; dim = d; }
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:395

References dim, nBuckets, and splitBucket.

Member Function Documentation

◆ operator()()

bool CompareToBucket::operator() ( const BVHPrimitiveInfo p) const

Definition at line 399 of file cbvh_pbrt.cpp.

400 {
401  const float centroid = p.centroid[dim];
402 
403  int b = nBuckets *
404  // Computes the offset (0.0 - 1.0) for one axis
405  ( ( centroid - centroidBounds.Min()[dim] ) /
406  ( centroidBounds.Max()[dim] - centroidBounds.Min()[dim] ) );
407 
408  if( b == nBuckets )
409  b = nBuckets - 1;
410 
411  wxASSERT( (b >= 0) && (b < nBuckets) );
412 
413  return b <= splitBucket;
414 }
const SFVEC3F & Max() const
Function Max return the maximum vertex pointer.
Definition: cbbox.h:212
const SFVEC3F & Min() const
Function Min return the minimun vertex pointer.
Definition: cbbox.h:205
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:395

References BVHPrimitiveInfo::centroid, centroidBounds, dim, CBBOX::Max(), CBBOX::Min(), nBuckets, and splitBucket.

Member Data Documentation

◆ centroidBounds

const CBBOX& CompareToBucket::centroidBounds

Definition at line 395 of file cbvh_pbrt.cpp.

Referenced by operator()().

◆ dim

int CompareToBucket::dim

Definition at line 393 of file cbvh_pbrt.cpp.

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

◆ nBuckets

int CompareToBucket::nBuckets

Definition at line 393 of file cbvh_pbrt.cpp.

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

◆ splitBucket

int CompareToBucket::splitBucket

Definition at line 393 of file cbvh_pbrt.cpp.

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


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