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 375 of file cbvh_pbrt.cpp.

Constructor & Destructor Documentation

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

Definition at line 377 of file cbvh_pbrt.cpp.

References dim, nBuckets, and splitBucket.

378  : centroidBounds(b)
379  { splitBucket = split; nBuckets = num; dim = d; }
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:385

Member Function Documentation

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

Definition at line 389 of file cbvh_pbrt.cpp.

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

390 {
391  const float centroid = p.centroid[dim];
392 
393  int b = nBuckets *
394  // Computes the offset (0.0 - 1.0) for one axis
395  ( ( centroid - centroidBounds.Min()[dim] ) /
396  ( centroidBounds.Max()[dim] - centroidBounds.Min()[dim] ) );
397 
398  if( b == nBuckets )
399  b = nBuckets - 1;
400 
401  wxASSERT( (b >= 0) && (b < nBuckets) );
402 
403  return b <= splitBucket;
404 }
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
const CBBOX & centroidBounds
Definition: cbvh_pbrt.cpp:385

Member Data Documentation

const CBBOX& CompareToBucket::centroidBounds

Definition at line 385 of file cbvh_pbrt.cpp.

Referenced by operator()().

int CompareToBucket::dim

Definition at line 383 of file cbvh_pbrt.cpp.

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

int CompareToBucket::nBuckets

Definition at line 383 of file cbvh_pbrt.cpp.

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

int CompareToBucket::splitBucket

Definition at line 383 of file cbvh_pbrt.cpp.

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


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