diff --git a/include/fcl/BV/BV_node.h b/include/fcl/BV/BV_node.h index 6dd62d743..97ed69e10 100644 --- a/include/fcl/BV/BV_node.h +++ b/include/fcl/BV/BV_node.h @@ -156,7 +156,7 @@ Vector3::Scalar> BVNode::getCenter() const template struct GetOrientationImpl { - Matrix3 operator()(/*const BVNode& node*/) + static Matrix3 run(const BVNode& /*node*/) { return Matrix3::Identity(); } @@ -166,15 +166,14 @@ struct GetOrientationImpl template Matrix3 BVNode::getOrientation() const { - GetOrientationImpl getOrientationImpl; - return getOrientationImpl(bv); + return GetOrientationImpl::run(bv); } //============================================================================== template struct GetOrientationImpl> { - Matrix3 operator()(const OBB& bv) + static Matrix3 run(const OBB& bv) { return bv.frame.linear(); } @@ -184,7 +183,7 @@ struct GetOrientationImpl> template struct GetOrientationImpl> { - Matrix3 operator()(const RSS& bv) + static Matrix3 run(const RSS& bv) { return bv.frame.linear(); } @@ -194,7 +193,7 @@ struct GetOrientationImpl> template struct GetOrientationImpl> { - Matrix3 operator()(const OBBRSS& bv) + static Matrix3 run(const OBBRSS& bv) { return bv.obb.frame.linear(); } diff --git a/include/fcl/BV/kDOP.h b/include/fcl/BV/kDOP.h index db3556e3b..fd8139039 100644 --- a/include/fcl/BV/kDOP.h +++ b/include/fcl/BV/kDOP.h @@ -412,7 +412,7 @@ void minmax(Scalar p, Scalar& minv, Scalar& maxv) template struct GetDistancesImpl { - void operator()(const Vector3& p, Scalar* d) + static void run(const Vector3& /*p*/, Scalar* /*d*/) { // Do nothing } @@ -422,15 +422,14 @@ struct GetDistancesImpl template void getDistances(const Vector3& p, Scalar* d) { - GetDistancesImpl getDistancesImpl; - getDistancesImpl(p, d); + GetDistancesImpl::run(p, d); } //============================================================================== template struct GetDistancesImpl { - void operator()(const Vector3& p, Scalar* d) + static void run(const Vector3& p, Scalar* d) { d[0] = p[0] + p[1]; d[1] = p[0] + p[2]; @@ -444,7 +443,7 @@ struct GetDistancesImpl template struct GetDistancesImpl { - void operator()(const Vector3& p, Scalar* d) + static void run(const Vector3& p, Scalar* d) { d[0] = p[0] + p[1]; d[1] = p[0] + p[2]; @@ -459,7 +458,7 @@ struct GetDistancesImpl template struct GetDistancesImpl { - void operator()(const Vector3& p, Scalar* d) + static void run(const Vector3& p, Scalar* d) { d[0] = p[0] + p[1]; d[1] = p[0] + p[2]; diff --git a/include/fcl/BVH/BVH_model.h b/include/fcl/BVH/BVH_model.h index 30f214805..4876ff2f6 100644 --- a/include/fcl/BVH/BVH_model.h +++ b/include/fcl/BVH/BVH_model.h @@ -378,7 +378,7 @@ OBJECT_TYPE BVHModel::getObjectType() const template struct GetNodeTypeImpl { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_UNKNOWN; } @@ -388,8 +388,7 @@ struct GetNodeTypeImpl template NODE_TYPE BVHModel::getNodeType() const { - GetNodeTypeImpl getNodeTypeImpl; - return getNodeTypeImpl(); + return GetNodeTypeImpl::run(); } //============================================================================== @@ -1205,7 +1204,7 @@ int BVHModel::recursiveRefitTree_bottomup(int bv_id) template struct MakeParentRelativeRecurseImpl { - void operator()(BVHModel& model, + static void run(BVHModel& model, int bv_id, const Matrix3& parent_axis, const Vector3& parent_c) @@ -1230,8 +1229,8 @@ void BVHModel::makeParentRelativeRecurse( const Matrix3& parent_axis, const Vector3& parent_c) { - MakeParentRelativeRecurseImpl tmp; - tmp(*this, bv_id, parent_axis, parent_c); + MakeParentRelativeRecurseImpl::run( + *this, bv_id, parent_axis, parent_c); } //============================================================================== @@ -1278,7 +1277,7 @@ void BVHModel::computeLocalAABB() template struct MakeParentRelativeRecurseImpl> { - void operator()(BVHModel>& model, + static void run(BVHModel>& model, int bv_id, const Matrix3& parent_axis, const Vector3& parent_c) @@ -1303,7 +1302,7 @@ struct MakeParentRelativeRecurseImpl> template struct MakeParentRelativeRecurseImpl> { - void operator()(BVHModel>& model, + static void run(BVHModel>& model, int bv_id, const Matrix3& parent_axis, const Vector3& parent_c) @@ -1328,7 +1327,7 @@ struct MakeParentRelativeRecurseImpl> template struct MakeParentRelativeRecurseImpl> { - void operator()(BVHModel>& model, + static void run(BVHModel>& model, int bv_id, const Matrix3& parent_axis, const Vector3& parent_c) @@ -1357,7 +1356,7 @@ struct MakeParentRelativeRecurseImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_AABB; } @@ -1367,7 +1366,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_OBB; } @@ -1377,7 +1376,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_RSS; } @@ -1387,7 +1386,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_kIOS; } @@ -1397,7 +1396,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_OBBRSS; } @@ -1407,7 +1406,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_KDOP16; } @@ -1417,7 +1416,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_KDOP18; } @@ -1427,7 +1426,7 @@ struct GetNodeTypeImpl> template struct GetNodeTypeImpl> { - NODE_TYPE operator()() + static NODE_TYPE run() { return BV_KDOP24; } diff --git a/include/fcl/BVH/BV_splitter.h b/include/fcl/BVH/BV_splitter.h index 21256f561..994af8f44 100644 --- a/include/fcl/BVH/BV_splitter.h +++ b/include/fcl/BVH/BV_splitter.h @@ -246,7 +246,7 @@ void BVSplitter::computeRule( template struct ApplyImpl { - bool operator()( + static bool run( const BVSplitter& splitter, const Vector3& q) { return q[splitter.split_axis] > splitter.split_value; @@ -257,15 +257,14 @@ struct ApplyImpl template bool BVSplitter::apply(const Vector3& q) const { - ApplyImpl applyImpl; - return applyImpl(*this, q); + return ApplyImpl::run(*this, q); } //============================================================================== template struct ComputeRuleCenterImpl { - void operator()( + static void run( BVSplitter& splitter, const BV& bv, unsigned int* /*primitive_indices*/, @@ -289,15 +288,15 @@ template void BVSplitter::computeRule_bvcenter( const BV& bv, unsigned int* primitive_indices, int num_primitives) { - ComputeRuleCenterImpl computeRuleCenterImpl; - computeRuleCenterImpl(*this, bv, primitive_indices, num_primitives); + ComputeRuleCenterImpl::run( + *this, bv, primitive_indices, num_primitives); } //============================================================================== template struct ComputeRuleMeanImpl { - void operator()( + static void run( BVSplitter& splitter, const BV& bv, unsigned int* primitive_indices, @@ -342,15 +341,15 @@ template void BVSplitter::computeRule_mean( const BV& bv, unsigned int* primitive_indices, int num_primitives) { - ComputeRuleMeanImpl computeRuleMeanImpl; - computeRuleMeanImpl(*this, bv, primitive_indices, num_primitives); + ComputeRuleMeanImpl::run( + *this, bv, primitive_indices, num_primitives); } //============================================================================== template struct ComputeRuleMedianImpl { - void operator()( + static void run( BVSplitter& splitter, const BV& bv, unsigned int* primitive_indices, @@ -400,15 +399,15 @@ template void BVSplitter::computeRule_median( const BV& bv, unsigned int* primitive_indices, int num_primitives) { - ComputeRuleMedianImpl computeRuleMedianImpl; - computeRuleMedianImpl(*this, bv, primitive_indices, num_primitives); + ComputeRuleMedianImpl::run( + *this, bv, primitive_indices, num_primitives); } //============================================================================== template struct ComputeRuleCenterImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBB& bv, unsigned int* /*primitive_indices*/, @@ -423,7 +422,7 @@ struct ComputeRuleCenterImpl> template struct ComputeRuleMeanImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBB& bv, unsigned int* primitive_indices, @@ -440,7 +439,7 @@ struct ComputeRuleMeanImpl> template struct ComputeRuleMedianImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBB& bv, unsigned int* primitive_indices, @@ -457,7 +456,7 @@ struct ComputeRuleMedianImpl> template struct ComputeRuleCenterImpl> { - void operator()( + static void run( BVSplitter>& splitter, const RSS& bv, unsigned int* /*primitive_indices*/, @@ -472,7 +471,7 @@ struct ComputeRuleCenterImpl> template struct ComputeRuleMeanImpl> { - void operator()( + static void run( BVSplitter>& splitter, const RSS& bv, unsigned int* primitive_indices, @@ -489,7 +488,7 @@ struct ComputeRuleMeanImpl> template struct ComputeRuleMedianImpl> { - void operator()( + static void run( BVSplitter>& splitter, const RSS& bv, unsigned int* primitive_indices, @@ -506,7 +505,7 @@ struct ComputeRuleMedianImpl> template struct ComputeRuleCenterImpl> { - void operator()( + static void run( BVSplitter>& splitter, const kIOS& bv, unsigned int* /*primitive_indices*/, @@ -521,7 +520,7 @@ struct ComputeRuleCenterImpl> template struct ComputeRuleMeanImpl> { - void operator()( + static void run( BVSplitter>& splitter, const kIOS& bv, unsigned int* primitive_indices, @@ -538,7 +537,7 @@ struct ComputeRuleMeanImpl> template struct ComputeRuleMedianImpl> { - void operator()( + static void run( BVSplitter>& splitter, const kIOS& bv, unsigned int* primitive_indices, @@ -555,7 +554,7 @@ struct ComputeRuleMedianImpl> template struct ComputeRuleCenterImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBBRSS& bv, unsigned int* /*primitive_indices*/, @@ -570,7 +569,7 @@ struct ComputeRuleCenterImpl> template struct ComputeRuleMeanImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBBRSS& bv, unsigned int* primitive_indices, @@ -587,7 +586,7 @@ struct ComputeRuleMeanImpl> template struct ComputeRuleMedianImpl> { - void operator()( + static void run( BVSplitter>& splitter, const OBBRSS& bv, unsigned int* primitive_indices, @@ -604,7 +603,7 @@ struct ComputeRuleMedianImpl> template struct ApplyImpl> { - bool operator()( + static bool run( const BVSplitter>& splitter, const Vector3& q) { @@ -616,7 +615,7 @@ struct ApplyImpl> template struct ApplyImpl> { - bool operator()( + static bool run( const BVSplitter>& splitter, const Vector3& q) { @@ -628,7 +627,7 @@ struct ApplyImpl> template struct ApplyImpl> { - bool operator()( + static bool run( const BVSplitter>& splitter, const Vector3& q) { @@ -640,7 +639,7 @@ struct ApplyImpl> template struct ApplyImpl> { - bool operator()( + static bool run( const BVSplitter>& splitter, const Vector3& q) { @@ -661,7 +660,7 @@ void BVSplitter::clear() template struct ComputeSplitVectorImpl { - void operator()(const BV& bv, Vector3& split_vector) + static void run(const BV& bv, Vector3& split_vector) { split_vector = bv.frame.linear().col(0); } @@ -671,15 +670,14 @@ struct ComputeSplitVectorImpl template void computeSplitVector(const BV& bv, Vector3& split_vector) { - ComputeSplitVectorImpl computeSplitVectorImpl; - computeSplitVectorImpl(bv, split_vector); + ComputeSplitVectorImpl::run(bv, split_vector); } //============================================================================== template struct ComputeSplitVectorImpl> { - void operator()(const kIOS& bv, Vector3& split_vector) + static void run(const kIOS& bv, Vector3& split_vector) { /* switch(bv.num_spheres) @@ -717,7 +715,7 @@ struct ComputeSplitVectorImpl> template struct ComputeSplitVectorImpl> { - void operator()(const OBBRSS& bv, Vector3& split_vector) + static void run(const OBBRSS& bv, Vector3& split_vector) { split_vector = bv.obb.frame.linear().col(0); } diff --git a/include/fcl/broadphase/hierarchy_tree.h b/include/fcl/broadphase/hierarchy_tree.h index df8af5720..7021ad7d4 100644 --- a/include/fcl/broadphase/hierarchy_tree.h +++ b/include/fcl/broadphase/hierarchy_tree.h @@ -94,15 +94,23 @@ bool nodeBaseLess(NodeBase* a, NodeBase* b, int d) //============================================================================== template -struct SelectImpl1 +struct SelectImpl { - std::size_t operator()( + static std::size_t run( const NodeBase& /*query*/, const NodeBase& /*node1*/, const NodeBase& /*node2*/) { return 0; } + + static std::size_t run( + const BV& /*query*/, + const NodeBase& /*node1*/, + const NodeBase& /*node2*/) + { + return 0; + } }; /// @brief select from node1 and node2 which is close to a given query. 0 for node1 and 1 for node2 @@ -112,23 +120,9 @@ size_t select( const NodeBase& node1, const NodeBase& node2) { - SelectImpl1 selectImpl; - return selectImpl(query, node1, node2); + return SelectImpl::run(query, node1, node2); } -//============================================================================== -template -struct SelectImpl2 -{ - std::size_t operator()( - const BV& /*query*/, - const NodeBase& /*node1*/, - const NodeBase& /*node2*/) - { - return 0; - } -}; - /// @brief select from node1 and node2 which is close to a given query bounding volume. 0 for node1 and 1 for node2 template size_t select( @@ -136,30 +130,18 @@ size_t select( const NodeBase& node1, const NodeBase& node2) { - SelectImpl2 selectImpl; - return selectImpl(query, node1, node2); + return SelectImpl::run(query, node1, node2); } /// @brief Class for hierarchy tree structure template class HierarchyTree { +public: using Scalar = typename BV::Scalar; typedef NodeBase NodeType; - typedef typename std::vector* >::iterator NodeVecIterator; - typedef typename std::vector* >::const_iterator NodeVecConstIterator; - - struct SortByMorton - { - bool operator() (const NodeType* a, const NodeType* b) const - { - return a->code < b->code; - } - }; - -public: /// @brief Create hierarchy tree with suitable setting. /// bu_threshold decides the height of tree node to start bottom-up construction / optimization; @@ -230,6 +212,17 @@ class HierarchyTree private: + typedef typename std::vector* >::iterator NodeVecIterator; + typedef typename std::vector* >::const_iterator NodeVecConstIterator; + + struct SortByMorton + { + bool operator() (const NodeType* a, const NodeType* b) const + { + return a->code < b->code; + } + }; + /// @brief construct a tree for a set of leaves from bottom -- very heavy way void bottomup(const NodeVecIterator lbeg, const NodeVecIterator lend); @@ -388,9 +381,14 @@ struct nodeBaseLess //============================================================================== template -struct SelectImpl3 +struct SelectImpl { - bool operator()(size_t query, size_t node1, size_t node2, NodeBase* nodes) + static bool run(size_t query, size_t node1, size_t node2, NodeBase* nodes) + { + return 0; + } + + static bool run(const BV& query, size_t node1, size_t node2, NodeBase* nodes) { return 0; } @@ -400,26 +398,14 @@ struct SelectImpl3 template size_t select(size_t query, size_t node1, size_t node2, NodeBase* nodes) { - SelectImpl3 selectImpl; - return selectImpl(query, node1, node2, nodes); + return SelectImpl::run(query, node1, node2, nodes); } -//============================================================================== -template -struct SelectImpl4 -{ - bool operator()(const BV& query, size_t node1, size_t node2, NodeBase* nodes) - { - return 0; - } -}; - /// @brief select the node from node1 and node2 which is close to the query AABB. 0 for node1 and 1 for node2. template size_t select(const BV& query, size_t node1, size_t node2, NodeBase* nodes) { - SelectImpl4 selectImpl; - return selectImpl(query, node1, node2, nodes); + return SelectImpl::run(query, node1, node2, nodes); } /// @brief Class for hierarchy tree structure @@ -732,9 +718,9 @@ bool HierarchyTree::update(NodeType* leaf, const BV& bv) //============================================================================== template -struct UpdateImpl1 +struct UpdateImpl { - bool operator()( + static bool run( const HierarchyTree& tree, typename HierarchyTree::NodeType* leaf, const BV& bv, @@ -745,36 +731,29 @@ struct UpdateImpl1 tree.update_(leaf, bv); return true; } -}; - -template -bool HierarchyTree::update(NodeType* leaf, const BV& bv, const Vector3& vel, Scalar margin) -{ - UpdateImpl1 updateImpl; - return updateImpl(leaf, bv, vel, margin); -} -//============================================================================== -template -struct UpdateImpl2 -{ - bool operator()( + static bool run( const HierarchyTree& tree, typename HierarchyTree::NodeType* leaf, const BV& bv, - const Vector3& vel) + const Vector3& /*vel*/) { if(leaf->bv.contain(bv)) return false; - update_(leaf, bv); + tree.update_(leaf, bv); return true; } }; +template +bool HierarchyTree::update(NodeType* leaf, const BV& bv, const Vector3& vel, Scalar margin) +{ + return UpdateImpl::run(*this, leaf, bv, vel, margin); +} + template bool HierarchyTree::update(NodeType* leaf, const BV& bv, const Vector3& vel) { - UpdateImpl2 updateImpl; - return updateImpl(leaf, bv, vel); + return UpdateImpl::run(*this, leaf, bv, vel); } template @@ -2504,9 +2483,9 @@ void HierarchyTree::fetchLeaves(size_t root, NodeType*& leaves, int depth) //============================================================================== template -struct SelectImpl1> +struct SelectImpl> { - std::size_t operator()( + static std::size_t run( const NodeBase>& node, const NodeBase>& node1, const NodeBase>& node2) @@ -2521,13 +2500,8 @@ struct SelectImpl1> Scalar d2 = fabs(v2[0]) + fabs(v2[1]) + fabs(v2[2]); return (d1 < d2) ? 0 : 1; } -}; -//============================================================================== -template -struct SelectImpl2> -{ - std::size_t operator()( + static std::size_t run( const AABB& query, const NodeBase>& node1, const NodeBase>& node2) @@ -2542,13 +2516,8 @@ struct SelectImpl2> Scalar d2 = fabs(v2[0]) + fabs(v2[1]) + fabs(v2[2]); return (d1 < d2) ? 0 : 1; } -}; -//============================================================================== -template -struct UpdateImpl1> -{ - bool operator()( + static bool run( const HierarchyTree>& tree, typename HierarchyTree>::NodeType* leaf, const AABB& bv_, @@ -2569,13 +2538,8 @@ struct UpdateImpl1> tree.update(leaf, bv); return true; } -}; -//============================================================================== -template -struct UpdateImpl2> -{ - bool operator()( + static bool run( const HierarchyTree>& tree, typename HierarchyTree>::NodeType* leaf, const AABB& bv_, @@ -2599,9 +2563,9 @@ namespace implementation_array //============================================================================== template -struct SelectImpl3> +struct SelectImpl> { - bool operator()(size_t query, size_t node1, size_t node2, NodeBase>* nodes) + static bool run(size_t query, size_t node1, size_t node2, NodeBase>* nodes) { const AABB& bv = nodes[query].bv; const AABB& bv1 = nodes[node1].bv; @@ -2613,13 +2577,8 @@ struct SelectImpl3> Scalar d2 = fabs(v2[0]) + fabs(v2[1]) + fabs(v2[2]); return (d1 < d2) ? 0 : 1; } -}; -//============================================================================== -template -struct SelectImpl4> -{ - bool operator()(const AABB& query, size_t node1, size_t node2, NodeBase>* nodes) + static bool run(const AABB& query, size_t node1, size_t node2, NodeBase>* nodes) { const AABB& bv = query; const AABB& bv1 = nodes[node1].bv; diff --git a/include/fcl/ccd/conservative_advancement.h b/include/fcl/ccd/conservative_advancement.h index 2a909780a..dd4001269 100644 --- a/include/fcl/ccd/conservative_advancement.h +++ b/include/fcl/ccd/conservative_advancement.h @@ -610,9 +610,9 @@ bool conservativeAdvancementShapeMeshOriented(const S& o1, //============================================================================== template -struct ConservativeAdvancementImpl1 +struct ConservativeAdvancementImpl { - bool operator()( + static bool run( const S& o1, const MotionBase* motion1, const BVHModel>& o2, @@ -620,17 +620,12 @@ struct ConservativeAdvancementImpl1 const NarrowPhaseSolver* nsolver, const CollisionRequest& request, CollisionResult& result, - typename NarrowPhaseSolver::Scalar& toc) + Scalar& toc) { return details::conservativeAdvancementShapeMeshOriented, NarrowPhaseSolver, ShapeMeshConservativeAdvancementTraversalNodeRSS >(o1, motion1, o2, motion2, nsolver, request, result, toc); } -}; -//============================================================================== -template -struct ConservativeAdvancementImpl2 -{ - bool operator()( + static bool run( const S& o1, const MotionBase* motion1, const BVHModel>& o2, @@ -654,8 +649,9 @@ bool conservativeAdvancement(const S& o1, CollisionResult& result, typename NarrowPhaseSolver::Scalar& toc) { - ConservativeAdvancementImpl1 conservativeAdvancementImpl; - return conservativeAdvancementImpl(o1, motion1, o2, motion2, nsolver, request, result, toc); + return ConservativeAdvancementImpl< + typename NarrowPhaseSolver::Scalar, S, NarrowPhaseSolver>::run( + o1, motion1, o2, motion2, nsolver, request, result, toc); } template @@ -668,15 +664,16 @@ bool conservativeAdvancement(const S& o1, CollisionResult& result, typename NarrowPhaseSolver::Scalar& toc) { - ConservativeAdvancementImpl2 conservativeAdvancementImpl; - return conservativeAdvancementImpl(o1, motion1, o2, motion2, nsolver, request, result, toc); + return ConservativeAdvancementImpl< + typename NarrowPhaseSolver::Scalar, S, NarrowPhaseSolver>::run( + o1, motion1, o2, motion2, nsolver, request, result, toc); } //============================================================================== template -struct ConservativeAdvancementImpl1>, NarrowPhaseSolver> +struct ConservativeAdvancementImpl>, NarrowPhaseSolver> { - bool operator()( + static bool run( const BVHModel>& o1, const MotionBase* motion1, const BVHModel>& o2, @@ -692,9 +689,9 @@ struct ConservativeAdvancementImpl1>, NarrowPhaseSo //============================================================================== template -struct ConservativeAdvancementImpl2>, NarrowPhaseSolver> +struct ConservativeAdvancementImpl>, NarrowPhaseSolver> { - bool operator()( + static bool run( const BVHModel>& o1, const MotionBase* motion1, const BVHModel>& o2, diff --git a/include/fcl/ccd/motion_base.h b/include/fcl/ccd/motion_base.h index 7a016f2f2..ae2460bdb 100644 --- a/include/fcl/ccd/motion_base.h +++ b/include/fcl/ccd/motion_base.h @@ -203,7 +203,7 @@ using MotionBasePtr = std::shared_ptr>; template struct TBVMotionBoundVisitorVisitImpl { - Scalar operator()( + static Scalar run( const TBVMotionBoundVisitor& /*visitor*/, const MotionT& /*motion*/) { @@ -224,8 +224,9 @@ typename BV::Scalar TBVMotionBoundVisitor::visit( const SplineMotion& motion) const { using Scalar = typename BV::Scalar; - TBVMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + + return TBVMotionBoundVisitorVisitImpl< + Scalar, BV, SplineMotion>::run(*this, motion); } //============================================================================== @@ -234,8 +235,9 @@ typename BV::Scalar TBVMotionBoundVisitor::visit( const ScrewMotion& motion) const { using Scalar = typename BV::Scalar; - TBVMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + + return TBVMotionBoundVisitorVisitImpl< + Scalar, BV, ScrewMotion>::run(*this, motion); } //============================================================================== @@ -244,8 +246,9 @@ typename BV::Scalar TBVMotionBoundVisitor::visit( const InterpMotion& motion) const { using Scalar = typename BV::Scalar; - TBVMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + + return TBVMotionBoundVisitorVisitImpl< + Scalar, BV, InterpMotion>::run(*this, motion); } //============================================================================== @@ -254,15 +257,16 @@ typename BV::Scalar TBVMotionBoundVisitor::visit( const TranslationMotion& motion) const { using Scalar = typename BV::Scalar; - TBVMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + + return TBVMotionBoundVisitorVisitImpl< + Scalar, BV, TranslationMotion>::run(*this, motion); } //============================================================================== template struct TBVMotionBoundVisitorVisitImpl, SplineMotion> { - Scalar operator()( + static Scalar run( const TBVMotionBoundVisitor>& visitor, const SplineMotion& motion) { @@ -324,7 +328,7 @@ struct TBVMotionBoundVisitorVisitImpl, SplineMotion> template struct TBVMotionBoundVisitorVisitImpl, ScrewMotion> { - Scalar operator()( + static Scalar run( const TBVMotionBoundVisitor>& visitor, const ScrewMotion& motion) { @@ -365,7 +369,7 @@ struct TBVMotionBoundVisitorVisitImpl, ScrewMotion> template struct TBVMotionBoundVisitorVisitImpl, InterpMotion> { - Scalar operator()( + static Scalar run( const TBVMotionBoundVisitor>& visitor, const InterpMotion& motion) { @@ -401,7 +405,7 @@ struct TBVMotionBoundVisitorVisitImpl, InterpMotion> template struct TBVMotionBoundVisitorVisitImpl, TranslationMotion> { - Scalar operator()( + static Scalar run( const TBVMotionBoundVisitor>& visitor, const TranslationMotion& motion) { @@ -413,7 +417,7 @@ struct TBVMotionBoundVisitorVisitImpl, TranslationMotion struct TriangleMotionBoundVisitorVisitImpl { - Scalar operator()( + static Scalar run( const TriangleMotionBoundVisitor& /*visitor*/, const MotionT& /*motion*/) { @@ -426,8 +430,8 @@ template Scalar TriangleMotionBoundVisitor::visit( const SplineMotion& motion) const { - TriangleMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + return TriangleMotionBoundVisitorVisitImpl< + Scalar, SplineMotion>::run(*this, motion); } //============================================================================== @@ -435,8 +439,8 @@ template Scalar TriangleMotionBoundVisitor::visit( const ScrewMotion& motion) const { - TriangleMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + return TriangleMotionBoundVisitorVisitImpl< + Scalar, ScrewMotion>::run(*this, motion); } //============================================================================== @@ -444,8 +448,8 @@ template Scalar TriangleMotionBoundVisitor::visit( const InterpMotion& motion) const { - TriangleMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + return TriangleMotionBoundVisitorVisitImpl< + Scalar, InterpMotion>::run(*this, motion); } //============================================================================== @@ -453,8 +457,8 @@ template Scalar TriangleMotionBoundVisitor::visit( const TranslationMotion& motion) const { - TriangleMotionBoundVisitorVisitImpl> visitMotionBaseImpl; - return visitMotionBaseImpl(*this, motion); + return TriangleMotionBoundVisitorVisitImpl< + Scalar, TranslationMotion>::run(*this, motion); } //============================================================================== @@ -465,7 +469,7 @@ Scalar TriangleMotionBoundVisitor::visit( template struct TriangleMotionBoundVisitorVisitImpl> { - Scalar operator()( + static Scalar run( const TriangleMotionBoundVisitor& visitor, const ScrewMotion& motion) { @@ -502,7 +506,7 @@ struct TriangleMotionBoundVisitorVisitImpl> template struct TriangleMotionBoundVisitorVisitImpl> { - Scalar operator()( + static Scalar run( const TriangleMotionBoundVisitor& visitor, const InterpMotion& motion) { @@ -535,7 +539,7 @@ struct TriangleMotionBoundVisitorVisitImpl> template struct TriangleMotionBoundVisitorVisitImpl> { - Scalar operator()( + static Scalar run( const TriangleMotionBoundVisitor& visitor, const SplineMotion& motion) { @@ -564,7 +568,7 @@ struct TriangleMotionBoundVisitorVisitImpl> template struct TriangleMotionBoundVisitorVisitImpl> { - Scalar operator()( + static Scalar run( const TriangleMotionBoundVisitor& visitor, const TranslationMotion& motion) { diff --git a/include/fcl/collision_func_matrix.h b/include/fcl/collision_func_matrix.h index 88dbc4fb5..c10fd77fb 100644 --- a/include/fcl/collision_func_matrix.h +++ b/include/fcl/collision_func_matrix.h @@ -529,7 +529,7 @@ struct BVHShapeCollider, T_SH, Narrow template struct BVHCollideImpl { - std::size_t operator()( + static std::size_t run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -567,8 +567,8 @@ std::size_t BVHCollide( const CollisionRequest& request, CollisionResult& result) { - BVHCollideImpl tmp; - return tmp(o1, tf1, o2, tf2, request, result); + return BVHCollideImpl::run( + o1, tf1, o2, tf2, request, result); } namespace details @@ -602,7 +602,7 @@ std::size_t orientedMeshCollide( template struct BVHCollideImpl> { - std::size_t operator()( + static std::size_t run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -620,7 +620,7 @@ struct BVHCollideImpl> template struct BVHCollideImpl> { - std::size_t operator()( + static std::size_t run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -638,7 +638,7 @@ struct BVHCollideImpl> template struct BVHCollideImpl> { - std::size_t operator()( + static std::size_t run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, diff --git a/include/fcl/distance_func_matrix.h b/include/fcl/distance_func_matrix.h index 644a517ac..636645b32 100644 --- a/include/fcl/distance_func_matrix.h +++ b/include/fcl/distance_func_matrix.h @@ -347,7 +347,7 @@ struct BVHShapeDistancer, T_SH, NarrowPhaseSolver> template struct BVHDistanceImpl { - Scalar operator()( + static Scalar run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -383,8 +383,8 @@ typename T_BVH::Scalar BVHDistance( const DistanceRequest& request, DistanceResult& result) { - BVHDistanceImpl tmp; - return tmp(o1, tf1, o2, tf2, request, result); + return BVHDistanceImpl::run( + o1, tf1, o2, tf2, request, result); } namespace details @@ -416,7 +416,7 @@ typename T_BVH::Scalar orientedMeshDistance( template struct BVHDistanceImpl> { - Scalar operator()( + static Scalar run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -434,7 +434,7 @@ struct BVHDistanceImpl> template struct BVHDistanceImpl> { - Scalar operator()( + static Scalar run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, @@ -452,7 +452,7 @@ struct BVHDistanceImpl> template struct BVHDistanceImpl> { - Scalar operator()( + static Scalar run( const CollisionGeometry* o1, const Transform3& tf1, const CollisionGeometry* o2, diff --git a/include/fcl/narrowphase/gjk_solver_indep.h b/include/fcl/narrowphase/gjk_solver_indep.h index 5ee05895c..50ce95764 100755 --- a/include/fcl/narrowphase/gjk_solver_indep.h +++ b/include/fcl/narrowphase/gjk_solver_indep.h @@ -221,7 +221,7 @@ bool GJKSolver_indep::shapeIntersect(const S1& s1, const Transform3 struct ShapeIntersectIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S1& s1, const Transform3& tf1, @@ -285,8 +285,8 @@ bool GJKSolver_indep::shapeIntersect( const Transform3& tf2, std::vector>* contacts) const { - ShapeIntersectIndepImpl shapeIntersectImpl; - return shapeIntersectImpl(*this, s1, tf1, s2, tf2, contacts); + return ShapeIntersectIndepImpl::run( + *this, s1, tf1, s2, tf2, contacts); } // Shape intersect algorithms not using built-in GJK algorithm @@ -317,7 +317,7 @@ bool GJKSolver_indep::shapeIntersect( template \ struct ShapeIntersectIndepImpl, SHAPE2>\ {\ - bool operator()(\ + static bool run(\ const GJKSolver_indep& /*gjkSolver*/,\ const SHAPE1& s1,\ const Transform3& tf1,\ @@ -333,7 +333,7 @@ bool GJKSolver_indep::shapeIntersect( template \ struct ShapeIntersectIndepImpl, SHAPE1>\ {\ - bool operator()(\ + static bool run(\ const GJKSolver_indep& /*gjkSolver*/,\ const SHAPE2& s1,\ const Transform3& tf1,\ @@ -376,7 +376,7 @@ FCL_GJK_INDEP_SHAPE_SHAPE_INTERSECT(Cone, Plane, details::conePlaneIntersect) template struct ShapeIntersectIndepImpl, Halfspace> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Halfspace& s1, const Transform3& tf1, @@ -395,7 +395,7 @@ struct ShapeIntersectIndepImpl, Halfspace> template struct ShapeIntersectIndepImpl, Plane> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Plane& s1, const Transform3& tf1, @@ -410,7 +410,7 @@ struct ShapeIntersectIndepImpl, Plane> template struct ShapeIntersectIndepImpl, Halfspace> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Plane& s1, const Transform3& tf1, @@ -429,7 +429,7 @@ struct ShapeIntersectIndepImpl, Halfspace> template struct ShapeIntersectIndepImpl, Plane> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Halfspace& s1, const Transform3& tf1, @@ -449,7 +449,7 @@ struct ShapeIntersectIndepImpl, Plane> template struct ShapeTriangleIntersectIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S& s, const Transform3& tf, @@ -516,8 +516,7 @@ bool GJKSolver_indep::shapeTriangleIntersect( Scalar* penetration_depth, Vector3* normal) const { - ShapeTriangleIntersectIndepImpl shapeTriangleIntersectImpl; - return shapeTriangleIntersectImpl( + return ShapeTriangleIntersectIndepImpl::run( *this, s, tf, P1, P2, P3, contact_points, penetration_depth, normal); } @@ -525,7 +524,7 @@ bool GJKSolver_indep::shapeTriangleIntersect( template struct ShapeTriangleIntersectIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s, const Transform3& tf, @@ -546,7 +545,7 @@ struct ShapeTriangleIntersectIndepImpl> template struct ShapeTransformedTriangleIntersectIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S& s, const Transform3& tf1, @@ -615,8 +614,7 @@ bool GJKSolver_indep::shapeTriangleIntersect( Scalar* penetration_depth, Vector3* normal) const { - ShapeTransformedTriangleIntersectIndepImpl shapeTriangleIntersectImpl; - return shapeTriangleIntersectImpl( + return ShapeTransformedTriangleIntersectIndepImpl::run( *this, s, tf1, P1, P2, P3, tf2, contact_points, penetration_depth, normal); } @@ -625,7 +623,7 @@ bool GJKSolver_indep::shapeTriangleIntersect( template struct ShapeTransformedTriangleIntersectIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s, const Transform3& tf1, @@ -647,7 +645,7 @@ struct ShapeTransformedTriangleIntersectIndepImpl> template struct ShapeTransformedTriangleIntersectIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Halfspace& s, const Transform3& tf1, @@ -669,7 +667,7 @@ struct ShapeTransformedTriangleIntersectIndepImpl> template struct ShapeTransformedTriangleIntersectIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Plane& s, const Transform3& tf1, @@ -691,7 +689,7 @@ struct ShapeTransformedTriangleIntersectIndepImpl> template struct ShapeDistanceIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S1& s1, const Transform3& tf1, @@ -751,8 +749,8 @@ bool GJKSolver_indep::shapeDistance( Vector3* p1, Vector3* p2) const { - ShapeDistanceIndepImpl shapeDistanceImpl; - return shapeDistanceImpl(*this, s1, tf1, s2, tf2, dist, p1, p2); + return ShapeDistanceIndepImpl::run( + *this, s1, tf1, s2, tf2, dist, p1, p2); } // Shape distance algorithms not using built-in GJK algorithm @@ -783,7 +781,7 @@ bool GJKSolver_indep::shapeDistance( template struct ShapeDistanceIndepImpl, Capsule> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s1, const Transform3& tf1, @@ -801,7 +799,7 @@ struct ShapeDistanceIndepImpl, Capsule> template struct ShapeDistanceIndepImpl, Sphere> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Capsule& s1, const Transform3& tf1, @@ -819,7 +817,7 @@ struct ShapeDistanceIndepImpl, Sphere> template struct ShapeDistanceIndepImpl, Sphere> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s1, const Transform3& tf1, @@ -837,7 +835,7 @@ struct ShapeDistanceIndepImpl, Sphere> template struct ShapeDistanceIndepImpl, Capsule> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Capsule& s1, const Transform3& tf1, @@ -855,7 +853,7 @@ struct ShapeDistanceIndepImpl, Capsule> template struct ShapeTriangleDistanceIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S& s, const Transform3& tf, @@ -917,8 +915,7 @@ bool GJKSolver_indep::shapeTriangleDistance( Vector3* p1, Vector3* p2) const { - ShapeTriangleDistanceIndepImpl shapeTriangleDistanceImpl; - return shapeTriangleDistanceImpl( + return ShapeTriangleDistanceIndepImpl::run( *this, s, tf, P1, P2, P3, dist, p1, p2); } @@ -926,7 +923,7 @@ bool GJKSolver_indep::shapeTriangleDistance( template struct ShapeTriangleDistanceIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s, const Transform3& tf, @@ -945,7 +942,7 @@ struct ShapeTriangleDistanceIndepImpl> template struct ShapeTransformedTriangleDistanceIndepImpl { - bool operator()( + static bool run( const GJKSolver_indep& gjkSolver, const S& s, const Transform3& tf1, @@ -1009,8 +1006,7 @@ bool GJKSolver_indep::shapeTriangleDistance( Vector3* p1, Vector3* p2) const { - ShapeTransformedTriangleDistanceIndepImpl shapeTriangleDistanceImpl; - return shapeTriangleDistanceImpl( + return ShapeTransformedTriangleDistanceIndepImpl::run( *this, s, tf1, P1, P2, P3, tf2, dist, p1, p2); } @@ -1018,7 +1014,7 @@ bool GJKSolver_indep::shapeTriangleDistance( template struct ShapeTransformedTriangleDistanceIndepImpl> { - bool operator()( + static bool run( const GJKSolver_indep& /*gjkSolver*/, const Sphere& s, const Transform3& tf1, diff --git a/include/fcl/narrowphase/gjk_solver_libccd.h b/include/fcl/narrowphase/gjk_solver_libccd.h index 7c7f9447b..4bbb2ba47 100755 --- a/include/fcl/narrowphase/gjk_solver_libccd.h +++ b/include/fcl/narrowphase/gjk_solver_libccd.h @@ -213,7 +213,7 @@ bool GJKSolver_libccd::shapeIntersect( template struct ShapeIntersectLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S1& s1, const Transform3& tf1, const S2& s2, const Transform3& tf2, @@ -273,8 +273,8 @@ bool GJKSolver_libccd::shapeIntersect( const S2& s2, const Transform3& tf2, std::vector>* contacts) const { - ShapeIntersectLibccdImpl shapeIntersectImpl; - return shapeIntersectImpl(*this, s1, tf1, s2, tf2, contacts); + return ShapeIntersectLibccdImpl::run( + *this, s1, tf1, s2, tf2, contacts); } // Shape intersect algorithms not using libccd @@ -305,7 +305,7 @@ bool GJKSolver_libccd::shapeIntersect( template \ struct ShapeIntersectLibccdImpl, SHAPE2>\ {\ - bool operator()(\ + static bool run(\ const GJKSolver_libccd& /*gjkSolver*/,\ const SHAPE1& s1,\ const Transform3& tf1,\ @@ -321,7 +321,7 @@ bool GJKSolver_libccd::shapeIntersect( template \ struct ShapeIntersectLibccdImpl, SHAPE1>\ {\ - bool operator()(\ + static bool run(\ const GJKSolver_libccd& /*gjkSolver*/,\ const SHAPE2& s1,\ const Transform3& tf1,\ @@ -364,7 +364,7 @@ FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Cone, Plane, details::conePlaneIntersect) template struct ShapeIntersectLibccdImpl, Halfspace> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Halfspace& s1, const Transform3& tf1, @@ -383,7 +383,7 @@ struct ShapeIntersectLibccdImpl, Halfspace> template struct ShapeIntersectLibccdImpl, Plane> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Plane& s1, const Transform3& tf1, @@ -398,7 +398,7 @@ struct ShapeIntersectLibccdImpl, Plane> template struct ShapeIntersectLibccdImpl, Halfspace> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Plane& s1, const Transform3& tf1, @@ -417,7 +417,7 @@ struct ShapeIntersectLibccdImpl, Halfspace> template struct ShapeIntersectLibccdImpl, Plane> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Halfspace& s1, const Transform3& tf1, @@ -437,7 +437,7 @@ struct ShapeIntersectLibccdImpl, Plane> template struct ShapeTriangleIntersectLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S& s, const Transform3& tf, @@ -483,8 +483,7 @@ bool GJKSolver_libccd::shapeTriangleIntersect( Scalar* penetration_depth, Vector3* normal) const { - ShapeTriangleIntersectLibccdImpl shapeTriangleIntersectImpl; - return shapeTriangleIntersectImpl( + return ShapeTriangleIntersectLibccdImpl::run( *this, s, tf, P1, P2, P3, contact_points, penetration_depth, normal); } @@ -492,7 +491,7 @@ bool GJKSolver_libccd::shapeTriangleIntersect( template struct ShapeTriangleIntersectLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s, const Transform3& tf, @@ -512,7 +511,7 @@ struct ShapeTriangleIntersectLibccdImpl> template struct ShapeTransformedTriangleIntersectLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S& s, const Transform3& tf1, @@ -560,8 +559,7 @@ bool GJKSolver_libccd::shapeTriangleIntersect( Scalar* penetration_depth, Vector3* normal) const { - ShapeTransformedTriangleIntersectLibccdImpl shapeTriangleIntersectImpl; - return shapeTriangleIntersectImpl( + return ShapeTransformedTriangleIntersectLibccdImpl::run( *this, s, tf1, P1, P2, P3, tf2, contact_points, penetration_depth, normal); } @@ -570,7 +568,7 @@ bool GJKSolver_libccd::shapeTriangleIntersect( template struct ShapeTransformedTriangleIntersectLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s, const Transform3& tf1, @@ -592,7 +590,7 @@ struct ShapeTransformedTriangleIntersectLibccdImpl> template struct ShapeTransformedTriangleIntersectLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Halfspace& s, const Transform3& tf1, @@ -614,7 +612,7 @@ struct ShapeTransformedTriangleIntersectLibccdImpl> template struct ShapeTransformedTriangleIntersectLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Plane& s, const Transform3& tf1, @@ -636,7 +634,7 @@ struct ShapeTransformedTriangleIntersectLibccdImpl> template struct ShapeDistanceLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S1& s1, const Transform3& tf1, @@ -684,8 +682,8 @@ bool GJKSolver_libccd::shapeDistance( Vector3* p1, Vector3* p2) const { - ShapeDistanceLibccdImpl shapeDistanceImpl; - return shapeDistanceImpl(*this, s1, tf1, s2, tf2, dist, p1, p2); + return ShapeDistanceLibccdImpl::run( + *this, s1, tf1, s2, tf2, dist, p1, p2); } // Shape distance algorithms not using libccd @@ -716,7 +714,7 @@ bool GJKSolver_libccd::shapeDistance( template struct ShapeDistanceLibccdImpl, Capsule> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s1, const Transform3& tf1, @@ -734,7 +732,7 @@ struct ShapeDistanceLibccdImpl, Capsule> template struct ShapeDistanceLibccdImpl, Sphere> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Capsule& s1, const Transform3& tf1, @@ -752,7 +750,7 @@ struct ShapeDistanceLibccdImpl, Sphere> template struct ShapeDistanceLibccdImpl, Sphere> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s1, const Transform3& tf1, @@ -770,7 +768,7 @@ struct ShapeDistanceLibccdImpl, Sphere> template struct ShapeDistanceLibccdImpl, Capsule> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Capsule& s1, const Transform3& tf1, @@ -788,7 +786,7 @@ struct ShapeDistanceLibccdImpl, Capsule> template struct ShapeTriangleDistanceLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S& s, const Transform3& tf, @@ -834,8 +832,7 @@ bool GJKSolver_libccd::shapeTriangleDistance( Vector3* p1, Vector3* p2) const { - ShapeTriangleDistanceLibccdImpl shapeTriangleDistanceImpl; - return shapeTriangleDistanceImpl( + return ShapeTriangleDistanceLibccdImpl::run( *this, s, tf, P1, P2, P3, dist, p1, p2); } @@ -843,7 +840,7 @@ bool GJKSolver_libccd::shapeTriangleDistance( template struct ShapeTriangleDistanceLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s, const Transform3& tf, @@ -862,7 +859,7 @@ struct ShapeTriangleDistanceLibccdImpl> template struct ShapeTransformedTriangleDistanceLibccdImpl { - bool operator()( + static bool run( const GJKSolver_libccd& gjkSolver, const S& s, const Transform3& tf1, @@ -911,8 +908,7 @@ bool GJKSolver_libccd::shapeTriangleDistance( Vector3* p1, Vector3* p2) const { - ShapeTransformedTriangleDistanceLibccdImpl shapeTriangleDistanceImpl; - return shapeTriangleDistanceImpl( + return ShapeTransformedTriangleDistanceLibccdImpl::run( *this, s, tf1, P1, P2, P3, tf2, dist, p1, p2); } @@ -920,7 +916,7 @@ bool GJKSolver_libccd::shapeTriangleDistance( template struct ShapeTransformedTriangleDistanceLibccdImpl> { - bool operator()( + static bool run( const GJKSolver_libccd& /*gjkSolver*/, const Sphere& s, const Transform3& tf1, diff --git a/include/fcl/traversal/distance/mesh_conservative_advancement_traversal_node.h b/include/fcl/traversal/distance/mesh_conservative_advancement_traversal_node.h index ccfebe510..a29f6c242 100644 --- a/include/fcl/traversal/distance/mesh_conservative_advancement_traversal_node.h +++ b/include/fcl/traversal/distance/mesh_conservative_advancement_traversal_node.h @@ -323,7 +323,7 @@ void MeshConservativeAdvancementTraversalNode::leafTesting(int b1, int b2) c template struct CanStopImpl { - bool operator()( + static bool run( const MeshConservativeAdvancementTraversalNode& node, Scalar c) { if((c >= node.w * (node.min_distance - node.abs_err)) @@ -389,15 +389,14 @@ template bool MeshConservativeAdvancementTraversalNode::canStop( MeshConservativeAdvancementTraversalNode::Scalar c) const { - CanStopImpl canStopImpl; - return canStopImpl(*this, c); + return CanStopImpl::run(*this, c); } //============================================================================== template struct CanStopImpl> { - bool operator()( + static bool run( const MeshConservativeAdvancementTraversalNode>& node, Scalar c) { @@ -420,7 +419,7 @@ struct CanStopImpl> template struct CanStopImpl> { - bool operator()( + static bool run( const MeshConservativeAdvancementTraversalNode>& node, Scalar c) { @@ -443,7 +442,7 @@ struct CanStopImpl> template struct CanStopImpl> { - bool operator()( + static bool run( const MeshConservativeAdvancementTraversalNode>& node, Scalar c) {