diff --git a/include/fcl/narrowphase/detail/conservative_advancement_func_matrix-inl.h b/include/fcl/narrowphase/detail/conservative_advancement_func_matrix-inl.h index d6431d6e3..b29e002e5 100644 --- a/include/fcl/narrowphase/detail/conservative_advancement_func_matrix-inl.h +++ b/include/fcl/narrowphase/detail/conservative_advancement_func_matrix-inl.h @@ -70,17 +70,16 @@ namespace fcl namespace detail { -//============================================================================== -template -bool conservativeAdvancement(const BVHModel& o1, - const MotionBase* motion1, - const BVHModel& o2, - const MotionBase* motion2, - const CollisionRequest& request, - CollisionResult& result, - typename BV::S& toc) -{ - using S = typename BV::S; + +template +bool conservativeAdvancementExec(TraversalNode& node, + const BVHModel& o1, + const MotionBase* motion1, + const BVHModel& o2, + const MotionBase* motion2, + const CollisionRequest& request, + CollisionResult& result, + S& toc) { Transform3 tf1; Transform3 tf2; @@ -94,13 +93,11 @@ bool conservativeAdvancement(const BVHModel& o1, return true; } + typedef typename TraversalNode::BV BV; BVHModel* o1_tmp = new BVHModel(o1); BVHModel* o2_tmp = new BVHModel(o2); - - MeshConservativeAdvancementTraversalNode node; - node.motion1 = motion1; node.motion2 = motion2; @@ -146,6 +143,56 @@ bool conservativeAdvancement(const BVHModel& o1, return false; } + + +//============================================================================== +template +bool conservativeAdvancement(const BVHModel& o1, + const MotionBase* motion1, + const BVHModel& o2, + const MotionBase* motion2, + const CollisionRequest& request, + CollisionResult& result, + typename BV::S& toc) +{ + + MeshConservativeAdvancementTraversalNode node; + + return conservativeAdvancementExec(node, o1, motion1, o2, motion2, request, result, toc); + +} + + +template +bool conservativeAdvancement(const BVHModel>& o1, + const MotionBase* motion1, + const BVHModel>& o2, + const MotionBase* motion2, + const CollisionRequest& request, + CollisionResult& result, + S& toc) +{ + + MeshConservativeAdvancementTraversalNodeRSS node; + + return conservativeAdvancementExec(node, o1, motion1, o2, motion2, request, result, toc); +} + +template +bool conservativeAdvancement(const BVHModel>& o1, + const MotionBase* motion1, + const BVHModel>& o2, + const MotionBase* motion2, + const CollisionRequest& request, + CollisionResult& result, + S& toc) +{ + + MeshConservativeAdvancementTraversalNodeOBBRSS node; + + return conservativeAdvancementExec(node, o1, motion1, o2, motion2, request, result, toc); +} + template bool conservativeAdvancementMeshOriented(const BVHModel& o1, const MotionBase* motion1, diff --git a/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node-inl.h b/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node-inl.h index 44ddde5fe..ee0dbce16 100644 --- a/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node-inl.h +++ b/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node-inl.h @@ -57,9 +57,9 @@ class FCL_EXPORT MeshConservativeAdvancementTraversalNodeRSS; extern template bool initialize( MeshConservativeAdvancementTraversalNodeRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, double w); @@ -71,9 +71,9 @@ class FCL_EXPORT MeshConservativeAdvancementTraversalNodeOBBRSS; extern template bool initialize( MeshConservativeAdvancementTraversalNodeOBBRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, double w); @@ -776,9 +776,9 @@ bool setupMeshConservativeAdvancementOrientedDistanceNode( template bool initialize( MeshConservativeAdvancementTraversalNodeRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, S w) { @@ -790,9 +790,9 @@ bool initialize( template bool initialize( MeshConservativeAdvancementTraversalNodeOBBRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, S w) { diff --git a/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.h b/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.h index be72620e6..a9d6f36df 100644 --- a/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.h +++ b/include/fcl/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.h @@ -49,13 +49,14 @@ namespace detail { /// @brief continuous collision node using conservative advancement. when using this default version, must refit the BVH in current configuration (R_t, T_t) into default configuration -template +template class FCL_EXPORT MeshConservativeAdvancementTraversalNode - : public MeshDistanceTraversalNode + : public MeshDistanceTraversalNode { public: - using S = typename BV::S; + typedef BV_ BV; + typedef typename BV::S S; MeshConservativeAdvancementTraversalNode(S w_ = 1); @@ -153,9 +154,9 @@ template FCL_EXPORT bool initialize( MeshConservativeAdvancementTraversalNodeRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, S w = 1); @@ -202,9 +203,9 @@ template FCL_EXPORT bool initialize( MeshConservativeAdvancementTraversalNodeOBBRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, S w = 1); diff --git a/src/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.cpp b/src/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.cpp index ed7d8cc0a..b262e234e 100644 --- a/src/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.cpp +++ b/src/narrowphase/detail/traversal/distance/mesh_conservative_advancement_traversal_node.cpp @@ -51,9 +51,9 @@ class MeshConservativeAdvancementTraversalNodeRSS; template bool initialize( MeshConservativeAdvancementTraversalNodeRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, double w); @@ -65,9 +65,9 @@ class MeshConservativeAdvancementTraversalNodeOBBRSS; template bool initialize( MeshConservativeAdvancementTraversalNodeOBBRSS& node, - const BVHModel>& model1, + BVHModel>& model1, const Transform3& tf1, - const BVHModel>& model2, + BVHModel>& model2, const Transform3& tf2, double w);