38 #ifndef COAL_TRAVERSAL_NODE_BASE_H
39 #define COAL_TRAVERSAL_NODE_BASE_H
51 class TraversalNodeBase {
53 TraversalNodeBase() : enable_statistics(false) {}
55 virtual ~TraversalNodeBase() {}
57 virtual void preprocess() {}
59 virtual void postprocess() {}
62 virtual bool isFirstNodeLeaf(
unsigned int )
const {
return true; }
65 virtual bool isSecondNodeLeaf(
unsigned int )
const {
return true; }
68 virtual bool firstOverSecond(
unsigned int ,
unsigned int )
const {
73 virtual int getFirstLeftChild(
unsigned int b)
const {
return (
int)
b; }
76 virtual int getFirstRightChild(
unsigned int b)
const {
return (
int)
b; }
79 virtual int getSecondLeftChild(
unsigned int b)
const {
return (
int)
b; }
82 virtual int getSecondRightChild(
unsigned int b)
const {
return (
int)
b; }
85 void enableStatistics(
bool enable) { enable_statistics = enable; }
94 bool enable_statistics;
103 class CollisionTraversalNodeBase :
public TraversalNodeBase {
105 CollisionTraversalNodeBase(
const CollisionRequest& request_)
106 : request(request_), result(NULL) {}
108 virtual ~CollisionTraversalNodeBase() {}
114 virtual bool BVDisjoints(
unsigned int b1,
unsigned int b2,
118 virtual void leafCollides(
unsigned int ,
unsigned int ,
122 bool canStop()
const {
return this->request.isSatisfied(*(this->result)); }
125 const CollisionRequest& request;
128 CollisionResult* result;
139 class DistanceTraversalNodeBase :
public TraversalNodeBase {
141 DistanceTraversalNodeBase() : result(NULL) {}
143 virtual ~DistanceTraversalNodeBase() {}
148 virtual CoalScalar BVDistanceLowerBound(
unsigned int ,
149 unsigned int )
const {
150 return (std::numeric_limits<CoalScalar>::max)();
154 virtual void leafComputeDistance(
unsigned int b1,
unsigned int b2)
const = 0;
157 virtual bool canStop(
CoalScalar )
const {
return false; }
160 DistanceRequest request;
163 DistanceResult* result;