FCL  0.6.0
Flexible Collision Library
shape_mesh_collision_traversal_node.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2016, Open Source Robotics Foundation
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 
38 #ifndef FCL_TRAVERSAL_SHAPEMESHCOLLISIONTRAVERSALNODE_H
39 #define FCL_TRAVERSAL_SHAPEMESHCOLLISIONTRAVERSALNODE_H
40 
41 #include "fcl/geometry/shape/utility.h"
42 #include "fcl/narrowphase/detail/traversal/collision/shape_bvh_collision_traversal_node.h"
43 
44 namespace fcl
45 {
46 
47 namespace detail
48 {
49 
51 template <typename Shape, typename BV, typename NarrowPhaseSolver>
53  : public ShapeBVHCollisionTraversalNode<Shape, BV>
54 {
55 public:
56  using S = typename BV::S;
57 
59 
61  void leafTesting(int b1, int b2) const;
62 
64  bool canStop() const;
65 
66  Vector3<S>* vertices;
67  Triangle* tri_indices;
68 
69  S cost_density;
70 
71  const NarrowPhaseSolver* nsolver;
72 };
73 
76 template <typename Shape, typename BV, typename NarrowPhaseSolver>
77 bool initialize(
79  const Shape& model1,
80  const Transform3<typename BV::S>& tf1,
81  BVHModel<BV>& model2,
82  Transform3<typename BV::S>& tf2,
83  const NarrowPhaseSolver* nsolver,
86  bool use_refit = false, bool refit_bottomup = false);
87 
89 template <typename Shape, typename NarrowPhaseSolver>
92  Shape, OBB<typename Shape::S>, NarrowPhaseSolver>
93 {
94 public:
96 
97  bool BVTesting(int b1, int b2) const;
98 
99  void leafTesting(int b1, int b2) const;
100 };
101 
104 template <typename Shape, typename NarrowPhaseSolver>
105 bool initialize(
107  const Shape& model1,
108  const Transform3<typename Shape::S>& tf1,
109  const BVHModel<OBB<typename Shape::S>>& model2,
110  const Transform3<typename Shape::S>& tf2,
111  const NarrowPhaseSolver* nsolver,
114 
115 template <typename Shape, typename NarrowPhaseSolver>
117  : public ShapeMeshCollisionTraversalNode<Shape, RSS<typename Shape::S>, NarrowPhaseSolver>
118 {
119 public:
121 
122  bool BVTesting(int b1, int b2) const;
123 
124  void leafTesting(int b1, int b2) const;
125 
126 };
127 
130 template <typename Shape, typename NarrowPhaseSolver>
131 bool initialize(
133  const Shape& model1,
134  const Transform3<typename Shape::S>& tf1,
135  const BVHModel<RSS<typename Shape::S>>& model2,
136  const Transform3<typename Shape::S>& tf2,
137  const NarrowPhaseSolver* nsolver,
140 
141 template <typename Shape, typename NarrowPhaseSolver>
143  : public ShapeMeshCollisionTraversalNode<Shape, kIOS<typename Shape::S>, NarrowPhaseSolver>
144 {
145 public:
147 
148  bool BVTesting(int b1, int b2) const;
149 
150  void leafTesting(int b1, int b2) const;
151 
152 };
153 
156 template <typename Shape, typename NarrowPhaseSolver>
157 bool initialize(
159  const Shape& model1,
160  const Transform3<typename Shape::S>& tf1,
161  const BVHModel<kIOS<typename Shape::S>>& model2,
162  const Transform3<typename Shape::S>& tf2,
163  const NarrowPhaseSolver* nsolver,
166 
167 template <typename Shape, typename NarrowPhaseSolver>
169  : public ShapeMeshCollisionTraversalNode<Shape, OBBRSS<typename Shape::S>, NarrowPhaseSolver>
170 {
171 public:
173 
174  bool BVTesting(int b1, int b2) const;
175 
176  void leafTesting(int b1, int b2) const;
177 
178 };
179 
182 template <typename Shape, typename NarrowPhaseSolver>
183 bool initialize(
185  const Shape& model1,
186  const Transform3<typename Shape::S>& tf1,
187  const BVHModel<OBBRSS<typename Shape::S>>& model2,
188  const Transform3<typename Shape::S>& tf2,
189  const NarrowPhaseSolver* nsolver,
192 
193 } // namespace detail
194 } // namespace fcl
195 
196 #include "fcl/narrowphase/detail/traversal/collision/shape_mesh_collision_traversal_node-inl.h"
197 
198 #endif
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
collision result
Definition: collision_request.h:48
Traversal node for collision between shape and BVH.
Definition: shape_bvh_collision_traversal_node.h:52
A class for rectangle sphere-swept bounding volume.
Definition: RSS.h:49
Definition: shape_mesh_collision_traversal_node.h:116
Transform3< BV::S > tf2
configuration of second object
Definition: traversal_node_base.h:88
void leafTesting(int b1, int b2) const
Intersection testing between leaves (one shape and one triangle)
Definition: shape_mesh_collision_traversal_node-inl.h:62
CollisionRequest< BV::S > request
request setting for collision
Definition: collision_traversal_node_base.h:72
Triangle with 3 indices for points.
Definition: triangle.h:47
bool BVTesting(int b1, int b2) const
BV culling test in one BVTT node.
Definition: shape_bvh_collision_traversal_node-inl.h:92
Traversal node for collision between shape and mesh.
Definition: shape_mesh_collision_traversal_node.h:52
request to the collision algorithm
Definition: collision_request.h:52
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: BVH_model.h:57
CollisionResult< BV::S > * result
collision result kept during the traversal iteration
Definition: collision_traversal_node_base.h:75
Transform3< BV::S > tf1
configuation of first object
Definition: traversal_node_base.h:85
Definition: shape_mesh_collision_traversal_node.h:168
bool canStop() const
Whether the traversal process can stop early.
Definition: shape_mesh_collision_traversal_node-inl.h:128
Definition: shape_mesh_collision_traversal_node.h:142
Class merging the OBB and RSS, can handle collision and distance simultaneously.
Definition: OBBRSS.h:50
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:48
Oriented bounding box class.
Definition: OBB.h:51
Traversal node for shape and mesh, when mesh BVH is one of the oriented node (OBB, RSS, OBBRSS, kIOS)
Definition: shape_mesh_collision_traversal_node.h:90