|
48 | 48 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/capsule_capsule.h"
|
49 | 49 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_box.h"
|
50 | 50 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_capsule.h"
|
| 51 | +#include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_cylinder.h" |
51 | 52 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_sphere.h"
|
52 | 53 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_triangle.h"
|
53 | 54 | #include "fcl/narrowphase/detail/primitive_shape_algorithm/box_box.h"
|
@@ -180,7 +181,7 @@ bool GJKSolver_libccd<S>::shapeIntersect(
|
180 | 181 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
181 | 182 | // | box | O | O | | | | | O | O | |
|
182 | 183 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
183 |
| -// | sphere |/////| O | | O | | | O | O | O | |
| 184 | +// | sphere |/////| O | | O | | O | O | O | O | |
184 | 185 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
185 | 186 | // | ellipsoid |/////|////////| | | | | O | O | TODO |
|
186 | 187 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
@@ -245,6 +246,8 @@ FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Sphere, Capsule, detail::sphereCapsuleInter
|
245 | 246 |
|
246 | 247 | FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Sphere, Box, detail::sphereBoxIntersect)
|
247 | 248 |
|
| 249 | +FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Sphere, Cylinder, detail::sphereCylinderIntersect) |
| 250 | + |
248 | 251 | FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Sphere, Halfspace, detail::sphereHalfspaceIntersect)
|
249 | 252 | FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Ellipsoid, Halfspace, detail::ellipsoidHalfspaceIntersect)
|
250 | 253 | FCL_GJK_LIBCCD_SHAPE_SHAPE_INTERSECT(Box, Halfspace, detail::boxHalfspaceIntersect)
|
@@ -656,7 +659,7 @@ bool GJKSolver_libccd<S>::shapeDistance(
|
656 | 659 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
657 | 660 | // | box | | O | | | | | | | |
|
658 | 661 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
659 |
| -// | sphere |/////| O | | O | | | | | O | |
| 662 | +// | sphere |/////| O | | O | | O | | | O | |
660 | 663 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
661 | 664 | // | ellipsoid |/////|////////| | | | | | | |
|
662 | 665 | // +------------+-----+--------+-----------+---------+------+----------+-------+------------+----------+
|
@@ -745,6 +748,42 @@ struct ShapeDistanceLibccdImpl<S, Capsule<S>, Sphere<S>>
|
745 | 748 | }
|
746 | 749 | };
|
747 | 750 |
|
| 751 | +//============================================================================== |
| 752 | +template<typename S> |
| 753 | +struct ShapeDistanceLibccdImpl<S, Sphere<S>, Cylinder<S>> |
| 754 | +{ |
| 755 | + static bool run( |
| 756 | + const GJKSolver_libccd<S>& /*gjkSolver*/, |
| 757 | + const Sphere<S>& s1, |
| 758 | + const Transform3<S>& tf1, |
| 759 | + const Cylinder<S>& s2, |
| 760 | + const Transform3<S>& tf2, |
| 761 | + S* dist, |
| 762 | + Vector3<S>* p1, |
| 763 | + Vector3<S>* p2) |
| 764 | + { |
| 765 | + return detail::sphereCylinderDistance(s1, tf1, s2, tf2, dist, p1, p2); |
| 766 | + } |
| 767 | +}; |
| 768 | + |
| 769 | +//============================================================================== |
| 770 | +template<typename S> |
| 771 | +struct ShapeDistanceLibccdImpl<S, Cylinder<S>, Sphere<S>> |
| 772 | +{ |
| 773 | + static bool run( |
| 774 | + const GJKSolver_libccd<S>& /*gjkSolver*/, |
| 775 | + const Cylinder<S>& s1, |
| 776 | + const Transform3<S>& tf1, |
| 777 | + const Sphere<S>& s2, |
| 778 | + const Transform3<S>& tf2, |
| 779 | + S* dist, |
| 780 | + Vector3<S>* p1, |
| 781 | + Vector3<S>* p2) |
| 782 | + { |
| 783 | + return detail::sphereCylinderDistance(s2, tf2, s1, tf1, dist, p2, p1); |
| 784 | + } |
| 785 | +}; |
| 786 | + |
748 | 787 | //==============================================================================
|
749 | 788 | template<typename S>
|
750 | 789 | struct ShapeDistanceLibccdImpl<S, Sphere<S>, Sphere<S>>
|
|
0 commit comments