GCC Code Coverage Report


Directory: ./
File: src/distance/sphere_sphere.cpp
Date: 2025-04-01 09:23:31
Exec Total Coverage
Lines: 4 4 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2018-2019, CNRS
5 * Author: Florent Lamiraux
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of Open Source Robotics Foundation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36 #include "coal/math/transform.h"
37 #include "coal/shape/geometric_shapes.h"
38 #include "coal/internal/shape_shape_func.h"
39 #include "coal/internal/traversal_node_base.h"
40
41 #include "../narrowphase/details.h"
42
43 #include "coal/tracy.hh"
44
45 // Note that partial specialization of template functions is not allowed.
46 // Therefore, two implementations with the default narrow phase solvers are
47 // provided. If another narrow phase solver were to be used, the default
48 // template implementation would be called, unless the function is also
49 // specialized for this new type.
50 //
51 // One solution would be to make narrow phase solvers derive from an abstract
52 // class and specialize the template for this abstract class.
53 namespace coal {
54 struct GJKSolver;
55
56 namespace internal {
57 template <>
58 72992 Scalar ShapeShapeDistance<Sphere, Sphere>(const CollisionGeometry* o1,
59 const Transform3s& tf1,
60 const CollisionGeometry* o2,
61 const Transform3s& tf2,
62 const GJKSolver*, const bool,
63 Vec3s& p1, Vec3s& p2, Vec3s& normal) {
64 COAL_TRACY_ZONE_SCOPED_N(
65 "coal::internal::ShapeShapeDistance<Sphere, Sphere>");
66 72992 const Sphere& s1 = static_cast<const Sphere&>(*o1);
67 72992 const Sphere& s2 = static_cast<const Sphere&>(*o2);
68 72992 return details::sphereSphereDistance(s1, tf1, s2, tf2, p1, p2, normal);
69 }
70 } // namespace internal
71
72 } // namespace coal
73