38 #ifndef HPP_FCL_TRAVERSAL_NODE_BASE_H
39 #define HPP_FCL_TRAVERSAL_NODE_BASE_H
52 class TraversalNodeBase {
54 TraversalNodeBase() : enable_statistics(false) {}
56 virtual ~TraversalNodeBase() {}
58 virtual void preprocess() {}
60 virtual void postprocess() {}
63 virtual bool isFirstNodeLeaf(
unsigned int )
const {
return true; }
66 virtual bool isSecondNodeLeaf(
unsigned int )
const {
return true; }
69 virtual bool firstOverSecond(
unsigned int ,
unsigned int )
const {
74 virtual int getFirstLeftChild(
unsigned int b)
const {
return (
int)
b; }
77 virtual int getFirstRightChild(
unsigned int b)
const {
return (
int)
b; }
80 virtual int getSecondLeftChild(
unsigned int b)
const {
return (
int)
b; }
83 virtual int getSecondRightChild(
unsigned int b)
const {
return (
int)
b; }
86 void enableStatistics(
bool enable) { enable_statistics = enable; }
95 bool enable_statistics;
104 class CollisionTraversalNodeBase :
public TraversalNodeBase {
106 CollisionTraversalNodeBase(
const CollisionRequest& request_)
107 : request(request_), result(NULL) {}
109 virtual ~CollisionTraversalNodeBase() {}
115 virtual bool BVDisjoints(
unsigned int b1,
unsigned int b2,
116 FCL_REAL& sqrDistLowerBound)
const = 0;
119 virtual void leafCollides(
unsigned int ,
unsigned int ,
123 bool canStop()
const {
return this->request.isSatisfied(*(this->result)); }
126 const CollisionRequest& request;
129 CollisionResult* result;
140 class DistanceTraversalNodeBase :
public TraversalNodeBase {
142 DistanceTraversalNodeBase() : result(NULL) {}
144 virtual ~DistanceTraversalNodeBase() {}
149 virtual FCL_REAL BVDistanceLowerBound(
unsigned int ,
150 unsigned int )
const {
151 return (std::numeric_limits<FCL_REAL>::max)();
155 virtual void leafComputeDistance(
unsigned int b1,
unsigned int b2)
const = 0;
158 virtual bool canStop(
FCL_REAL )
const {
return false; }
161 DistanceRequest request;
164 DistanceResult* result;