Helios++
Helios software for LiDAR simulations
KDTreePrimitiveComparator.h
1 #pragma once
2 
3 #include "Primitive.h"
4 
9  // *** ATTRIBUTES *** //
10  // ******************** //
14  int axis;
15 public:
16  // *** CONSTRUCTION / DESTRUCTION *** //
17  // ************************************ //
22  explicit KDTreePrimitiveComparator(int axis) {
23  this->axis = axis;
24  }
25 
26  // *** M E T H O D S *** //
27  // *********************** //
37  auto ax = a->getCentroid()[axis];
38  auto bx = b->getCentroid()[axis];
39  if (ax > bx) return true;
40  return false;
41  }
42 };
bool operator()(Primitive *a, Primitive *b)
KDTree primitive comparator functor.
Definition: KDTreePrimitiveComparator.h:36
KDTreePrimitiveComparator(int axis)
Constructor for KDTree primitive comparator.
Definition: KDTreePrimitiveComparator.h:22
virtual glm::dvec3 getCentroid()=0
Obtain the primitive centroid.
KDTree primitive comparator.
Definition: KDTreePrimitiveComparator.h:8
Abstract class defining the common behavior for all primitives.
Definition: Primitive.h:20
int axis
Index of axis considered for the comparison.
Definition: KDTreePrimitiveComparator.h:14