FCL  0.6.0
Flexible Collision Library
shape_mesh_conservative_advancement_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_SHAPEMESHCONSERVATIVEADVANCEMENTTRAVERSALNODE_H
39 #define FCL_TRAVERSAL_SHAPEMESHCONSERVATIVEADVANCEMENTTRAVERSALNODE_H
40 
41 #include "fcl/geometry/shape/utility.h"
42 #include "fcl/narrowphase/detail/traversal/distance/shape_mesh_distance_traversal_node.h"
43 #include "fcl/narrowphase/detail/traversal/distance/conservative_advancement_stack_data.h"
44 
45 namespace fcl
46 {
47 
48 namespace detail
49 {
50 
51 template <typename Shape, typename BV, typename NarrowPhaseSolver>
53  : public ShapeMeshDistanceTraversalNode<Shape, BV, NarrowPhaseSolver>
54 {
55 public:
56 
57  using S = typename BV::S;
58 
60 
62  S BVTesting(int b1, int b2) const;
63 
65  void leafTesting(int b1, int b2) const;
66 
68  bool canStop(S c) const;
69 
70  mutable S min_distance;
71 
72  mutable Vector3<S> closest_p1, closest_p2;
73 
74  mutable int last_tri_id;
75 
77  S w;
78 
80  S toc;
81  S t_err;
82 
84  mutable S delta_t;
85 
88  const MotionBase<S>* motion2;
89 
90  mutable std::vector<ConservativeAdvancementStackData<S>> stack;
91 };
92 
93 template <typename Shape, typename BV, typename NarrowPhaseSolver>
94 bool initialize(
96  const Shape& model1,
97  const Transform3<typename BV::S>& tf1,
98  BVHModel<BV>& model2,
99  const Transform3<typename BV::S>& tf2,
100  const NarrowPhaseSolver* nsolver,
101  typename BV::S w = 1,
102  bool use_refit = false,
103  bool refit_bottomup = false);
104 
105 template <typename Shape, typename NarrowPhaseSolver>
108  Shape, RSS<typename Shape::S>, NarrowPhaseSolver>
109 {
110 public:
111  using S = typename Shape::S;
112 
114 
115  S BVTesting(int b1, int b2) const;
116 
117  void leafTesting(int b1, int b2) const;
118 
119  bool canStop(S c) const;
120 };
121 
122 template <typename Shape, typename NarrowPhaseSolver>
123 bool initialize(
125  const Shape& model1,
126  const Transform3<typename Shape::S>& tf1,
127  const BVHModel<RSS<typename Shape::S>>& model2,
128  const Transform3<typename Shape::S>& tf2,
129  const NarrowPhaseSolver* nsolver,
130  typename Shape::S w = 1);
131 
132 template <typename Shape, typename NarrowPhaseSolver>
135  Shape, OBBRSS<typename Shape::S>, NarrowPhaseSolver>
136 {
137 public:
138  using S = typename Shape::S;
139 
141 
142  S BVTesting(int b1, int b2) const;
143 
144  void leafTesting(int b1, int b2) const;
145 
146  bool canStop(S c) const;
147 };
148 
149 template <typename Shape, typename NarrowPhaseSolver>
150 bool initialize(
152  const Shape& model1,
153  const Transform3<typename Shape::S>& tf1,
154  const BVHModel<OBBRSS<typename Shape::S>>& model2,
155  const Transform3<typename Shape::S>& tf2,
156  const NarrowPhaseSolver* nsolver,
157  typename Shape::S w = 1);
158 
159 } // namespace detail
160 } // namespace fcl
161 
162 #include "fcl/narrowphase/detail/traversal/distance/shape_mesh_conservative_advancement_traversal_node-inl.h"
163 
164 #endif
const MotionBase< S > * motion1
Motions for the two objects in query.
Definition: shape_mesh_conservative_advancement_traversal_node.h:87
S toc
The time from beginning point.
Definition: shape_mesh_conservative_advancement_traversal_node.h:80
Traversal node for distance between shape and mesh.
Definition: shape_mesh_distance_traversal_node.h:52
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
bool canStop(S c) const
Whether the traversal process can stop early.
Definition: shape_mesh_conservative_advancement_traversal_node-inl.h:130
A class for rectangle sphere-swept bounding volume.
Definition: RSS.h:49
Transform3< BV::S > tf2
configuration of second object
Definition: traversal_node_base.h:88
S delta_t
The delta_t each step.
Definition: shape_mesh_conservative_advancement_traversal_node.h:84
S BVTesting(int b1, int b2) const
BV culling test in one BVTT node.
Definition: shape_mesh_conservative_advancement_traversal_node-inl.h:69
Definition: shape_mesh_conservative_advancement_traversal_node.h:106
void leafTesting(int b1, int b2) const
Conservative advancement testing between leaves (one triangle and one shape)
Definition: shape_mesh_conservative_advancement_traversal_node-inl.h:82
Definition: bv_motion_bound_visitor.h:45
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: BVH_model.h:57
S w
CA controlling variable: early stop for the early iterations of CA.
Definition: shape_mesh_conservative_advancement_traversal_node.h:77
Transform3< BV::S > tf1
configuation of first object
Definition: traversal_node_base.h:85
Definition: shape_mesh_conservative_advancement_traversal_node.h:133
Definition: shape_mesh_conservative_advancement_traversal_node.h:52
Class merging the OBB and RSS, can handle collision and distance simultaneously.
Definition: OBBRSS.h:50