mesh_distance_traversal_node.h
Go to the documentation of this file.
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_MESHDISTANCETRAVERSALNODE_H
39 #define FCL_TRAVERSAL_MESHDISTANCETRAVERSALNODE_H
40 
42 #include "fcl/math/bv/RSS.h"
43 #include "fcl/math/bv/OBBRSS.h"
44 #include "fcl/math/bv/kIOS.h"
46 
47 namespace fcl
48 {
49 
50 namespace detail
51 {
52 
54 template <typename BV>
56 {
57 public:
58 
59  using S = typename BV::S;
60 
62 
64  void leafTesting(int b1, int b2) const;
65 
67  bool canStop(S c) const;
68 
71 
74 
78 };
79 
82 template <typename BV>
83 FCL_EXPORT
84 bool initialize(
86  BVHModel<BV>& model1,
88  BVHModel<BV>& model2,
90  const DistanceRequest<typename BV::S>& request,
92  bool use_refit = false, bool refit_bottomup = false);
93 
95 template <typename S>
97  : public MeshDistanceTraversalNode<RSS<S>>
98 {
99 public:
101 
102  void preprocess();
103 
104  void postprocess();
105 
106  S BVTesting(int b1, int b2) const
107  {
108  if (this->enable_statistics) this->num_bv_tests++;
109 
110  return distance(tf.linear(), tf.translation(), this->model1->getBV(b1).bv, this->model2->getBV(b2).bv);
111  }
112 
113  void leafTesting(int b1, int b2) const;
114 
116 
117  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
118 };
119 
122 
125 template <typename S>
126 FCL_EXPORT
127 bool initialize(
129  const BVHModel<RSS<S>>& model1,
130  const Transform3<S>& tf1,
131  const BVHModel<RSS<S>>& model2,
132  const Transform3<S>& tf2,
133  const DistanceRequest<S>& request,
134  DistanceResult<S>& result);
135 
136 template <typename S>
138  : public MeshDistanceTraversalNode<kIOS<S>>
139 {
140 public:
142 
143  void preprocess();
144 
145  void postprocess();
146 
147  S BVTesting(int b1, int b2) const
148  {
149  if (this->enable_statistics) this->num_bv_tests++;
150 
151  return distance(tf.linear(), tf.translation(), this->model1->getBV(b1).bv, this->model2->getBV(b2).bv);
152  }
153 
154  void leafTesting(int b1, int b2) const;
155 
157 
158  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
159 };
160 
163 
166 template <typename S>
167 FCL_EXPORT
168 bool initialize(
170  const BVHModel<kIOS<S>>& model1,
171  const Transform3<S>& tf1,
172  const BVHModel<kIOS<S>>& model2,
173  const Transform3<S>& tf2,
174  const DistanceRequest<S>& request,
175  DistanceResult<S>& result);
176 
177 template <typename S>
179  : public MeshDistanceTraversalNode<OBBRSS<S>>
180 {
181 public:
183 
184  void preprocess();
185 
186  void postprocess();
187 
188  S BVTesting(int b1, int b2) const
189  {
190  if (this->enable_statistics) this->num_bv_tests++;
191 
192  return distance(tf.linear(), tf.translation(), this->model1->getBV(b1).bv, this->model2->getBV(b2).bv);
193  }
194 
195  void leafTesting(int b1, int b2) const;
196 
198 
199  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
200 };
201 
204 
207 template <typename S>
208 FCL_EXPORT
209 bool initialize(
211  const BVHModel<OBBRSS<S>>& model1,
212  const Transform3<S>& tf1,
213  const BVHModel<OBBRSS<S>>& model2,
214  const Transform3<S>& tf2,
215  const DistanceRequest<S>& request,
216  DistanceResult<S>& result);
217 
218 template <typename BV>
219 FCL_DEPRECATED_EXPORT
221  int b1,
222  int b2,
223  const BVHModel<BV>* model1,
224  const BVHModel<BV>* model2,
225  Vector3<typename BV::S>* vertices1,
226  Vector3<typename BV::S>* vertices2,
227  Triangle* tri_indices1,
228  Triangle* tri_indices2,
229  const Matrix3<typename BV::S>& R,
230  const Vector3<typename BV::S>& T,
231  bool enable_statistics,
232  int& num_leaf_tests,
233  const DistanceRequest<typename BV::S>& request,
235 
236 template <typename BV>
237 FCL_EXPORT
239  int b1,
240  int b2,
241  const BVHModel<BV>* model1,
242  const BVHModel<BV>* model2,
243  Vector3<typename BV::S>* vertices1,
244  Vector3<typename BV::S>* vertices2,
245  Triangle* tri_indices1,
246  Triangle* tri_indices2,
247  const Transform3<typename BV::S>& tf,
248  bool enable_statistics,
249  int& num_leaf_tests,
250  const DistanceRequest<typename BV::S>& request,
252 
253 template <typename BV>
254 FCL_EXPORT
256  const BVHModel<BV>* model1,
257  const BVHModel<BV>* model2,
258  const Vector3<typename BV::S>* vertices1,
259  Vector3<typename BV::S>* vertices2,
260  Triangle* tri_indices1,
261  Triangle* tri_indices2,
262  int init_tri_id1,
263  int init_tri_id2,
264  const Matrix3<typename BV::S>& R,
265  const Vector3<typename BV::S>& T,
266  const DistanceRequest<typename BV::S>& request,
268 
269 template <typename BV>
270 FCL_EXPORT
272  const BVHModel<BV>* model1,
273  const BVHModel<BV>* model2,
274  const Vector3<typename BV::S>* vertices1,
275  Vector3<typename BV::S>* vertices2,
276  Triangle* tri_indices1,
277  Triangle* tri_indices2,
278  int init_tri_id1,
279  int init_tri_id2,
280  const Transform3<typename BV::S>& tf,
281  const DistanceRequest<typename BV::S>& request,
283 
284 template <typename BV>
285 FCL_EXPORT
287  const BVHModel<BV>* model1,
288  const BVHModel<BV>* model2,
289  const Transform3<typename BV::S>& tf1,
290  const DistanceRequest<typename BV::S>& request,
292 
293 } // namespace detail
294 } // namespace fcl
295 
297 
298 #endif
fcl::DistanceRequest
request to the distance computation
Definition: distance_request.h:52
fcl::Transform3
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
Definition: types.h:91
fcl::kIOS< S >
fcl::detail::MeshDistanceTraversalNodekIOS::tf
Transform3< S > tf
Definition: mesh_distance_traversal_node.h:156
fcl::detail::BVHDistanceTraversalNode< RSS< S > >::S
typename RSS< S > ::S S
Definition: bvh_distance_traversal_node.h:58
fcl::detail::MeshDistanceTraversalNodeOBBRSS::tf
Transform3< S > tf
Definition: mesh_distance_traversal_node.h:197
fcl::detail::MeshDistanceTraversalNode::vertices1
Vector3< S > * vertices1
Definition: mesh_distance_traversal_node.h:69
fcl::detail::MeshDistanceTraversalNodeRSS::tf
Transform3< S > tf
Definition: mesh_distance_traversal_node.h:115
fcl::detail::MeshDistanceTraversalNode::rel_err
S rel_err
relative and absolute error, default value is 0.01 for both terms
Definition: mesh_distance_traversal_node.h:76
fcl::detail::MeshDistanceTraversalNodeRSS::BVTesting
S BVTesting(int b1, int b2) const
BV test between b1 and b2.
Definition: mesh_distance_traversal_node.h:106
triangle_distance.h
fcl::RSS< S >
fcl::detail::MeshDistanceTraversalNode::tri_indices1
Triangle * tri_indices1
Definition: mesh_distance_traversal_node.h:72
fcl::Triangle
Triangle with 3 indices for points.
Definition: triangle.h:48
fcl::DistanceResult
distance result
Definition: distance_request.h:48
fcl::Vector3
Eigen::Matrix< S, 3, 1 > Vector3
Definition: types.h:70
fcl::detail::MeshDistanceTraversalNodekIOS
Definition: mesh_distance_traversal_node.h:137
fcl::Matrix3
Eigen::Matrix< S, 3, 3 > Matrix3
Definition: types.h:85
fcl::detail::distancePreprocessOrientedNode
void distancePreprocessOrientedNode(const BVHModel< BV > *model1, const BVHModel< BV > *model2, const Vector3< typename BV::S > *vertices1, Vector3< typename BV::S > *vertices2, Triangle *tri_indices1, Triangle *tri_indices2, int init_tri_id1, int init_tri_id2, const Matrix3< typename BV::S > &R, const Vector3< typename BV::S > &T, const DistanceRequest< typename BV::S > &request, DistanceResult< typename BV::S > &result)
Definition: mesh_distance_traversal_node-inl.h:503
fcl::detail::meshDistanceOrientedNodeLeafTesting
void meshDistanceOrientedNodeLeafTesting(int b1, int b2, const BVHModel< BV > *model1, const BVHModel< BV > *model2, Vector3< typename BV::S > *vertices1, Vector3< typename BV::S > *vertices2, Triangle *tri_indices1, Triangle *tri_indices2, const Matrix3< typename BV::S > &R, const Vector3< typename BV::S > &T, bool enable_statistics, int &num_leaf_tests, const DistanceRequest< typename BV::S > &request, DistanceResult< typename BV::S > &result)
Definition: mesh_distance_traversal_node-inl.h:402
fcl::detail::MeshDistanceTraversalNode
Traversal node for distance computation between two meshes.
Definition: mesh_distance_traversal_node.h:55
fcl::detail::initialize
template bool initialize(MeshCollisionTraversalNodeOBB< double > &node, const BVHModel< OBB< double >> &model1, const Transform3< double > &tf1, const BVHModel< OBB< double >> &model2, const Transform3< double > &tf2, const CollisionRequest< double > &request, CollisionResult< double > &result)
fcl::detail::MeshDistanceTraversalNode::tri_indices2
Triangle * tri_indices2
Definition: mesh_distance_traversal_node.h:73
fcl::detail::MeshDistanceTraversalNode::vertices2
Vector3< S > * vertices2
Definition: mesh_distance_traversal_node.h:70
fcl::detail::distance
template void distance(DistanceTraversalNodeBase< double > *node, BVHFrontList *front_list, int qsize)
fcl::OBBRSS< S >
fcl::BVHModel
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: BVH_model.h:57
OBBRSS.h
fcl::detail::MeshDistanceTraversalNodekIOS::BVTesting
S BVTesting(int b1, int b2) const
BV test between b1 and b2.
Definition: mesh_distance_traversal_node.h:147
fcl::detail::MeshDistanceTraversalNodeRSS
Traversal node for distance computation between two meshes if their underlying BVH node is oriented n...
Definition: mesh_distance_traversal_node.h:96
mesh_distance_traversal_node-inl.h
fcl::detail::MeshDistanceTraversalNode::abs_err
S abs_err
Definition: mesh_distance_traversal_node.h:77
fcl::detail::MeshDistanceTraversalNodeOBBRSS::BVTesting
S BVTesting(int b1, int b2) const
BV test between b1 and b2.
Definition: mesh_distance_traversal_node.h:188
fcl::detail::distancePostprocessOrientedNode
void distancePostprocessOrientedNode(const BVHModel< BV > *model1, const BVHModel< BV > *model2, const Transform3< typename BV::S > &tf1, const DistanceRequest< typename BV::S > &request, DistanceResult< typename BV::S > &result)
Definition: mesh_distance_traversal_node-inl.h:590
RSS.h
fcl::detail::MeshDistanceTraversalNodeOBBRSS
Definition: mesh_distance_traversal_node.h:178
fcl::detail::BVHDistanceTraversalNode
Traversal node for distance computation between BVH models.
Definition: bvh_distance_traversal_node.h:53
bvh_distance_traversal_node.h
kIOS.h
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45


fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:48