octree_solver.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_OCTREE_OCTREESOLVER_H
39 #define FCL_TRAVERSAL_OCTREE_OCTREESOLVER_H
40 
41 #include "fcl/config.h"
42 #if !(FCL_HAVE_OCTOMAP)
43 #error "This header requires fcl to be compiled with octomap support"
44 #endif
45 
46 #include "fcl/math/bv/utility.h"
49 #include "fcl/geometry/shape/box.h"
50 
51 namespace fcl
52 {
53 
54 namespace detail
55 {
56 
58 template <typename NarrowPhaseSolver>
59 class FCL_EXPORT OcTreeSolver
60 {
61 private:
62 
63  using S = typename NarrowPhaseSolver::S;
64 
65  const NarrowPhaseSolver* solver;
66 
67  mutable const CollisionRequest<S>* crequest;
68  mutable const DistanceRequest<S>* drequest;
69 
72 
73 public:
74  OcTreeSolver(const NarrowPhaseSolver* solver_);
75 
77  void OcTreeIntersect(const OcTree<S>* tree1, const OcTree<S>* tree2,
78  const Transform3<S>& tf1, const Transform3<S>& tf2,
79  const CollisionRequest<S>& request_,
80  CollisionResult<S>& result_) const;
81 
83  void OcTreeDistance(const OcTree<S>* tree1, const OcTree<S>* tree2,
84  const Transform3<S>& tf1, const Transform3<S>& tf2,
85  const DistanceRequest<S>& request_,
86  DistanceResult<S>& result_) const;
87 
89  template <typename BV>
90  void OcTreeMeshIntersect(const OcTree<S>* tree1, const BVHModel<BV>* tree2,
91  const Transform3<S>& tf1, const Transform3<S>& tf2,
92  const CollisionRequest<S>& request_,
93  CollisionResult<S>& result_) const;
94 
96  template <typename BV>
97  void OcTreeMeshDistance(const OcTree<S>* tree1, const BVHModel<BV>* tree2,
98  const Transform3<S>& tf1, const Transform3<S>& tf2,
99  const DistanceRequest<S>& request_,
100  DistanceResult<S>& result_) const;
101 
103  template <typename BV>
104  void MeshOcTreeIntersect(const BVHModel<BV>* tree1, const OcTree<S>* tree2,
105  const Transform3<S>& tf1, const Transform3<S>& tf2,
106  const CollisionRequest<S>& request_,
107  CollisionResult<S>& result_) const;
108 
110  template <typename BV>
111  void MeshOcTreeDistance(const BVHModel<BV>* tree1, const OcTree<S>* tree2,
112  const Transform3<S>& tf1, const Transform3<S>& tf2,
113  const DistanceRequest<S>& request_,
114  DistanceResult<S>& result_) const;
115 
117  template <typename Shape>
118  void OcTreeShapeIntersect(const OcTree<S>* tree, const Shape& s,
119  const Transform3<S>& tf1, const Transform3<S>& tf2,
120  const CollisionRequest<S>& request_,
121  CollisionResult<S>& result_) const;
122 
124  template <typename Shape>
125  void ShapeOcTreeIntersect(const Shape& s, const OcTree<S>* tree,
126  const Transform3<S>& tf1, const Transform3<S>& tf2,
127  const CollisionRequest<S>& request_,
128  CollisionResult<S>& result_) const;
129 
131  template <typename Shape>
132  void OcTreeShapeDistance(const OcTree<S>* tree, const Shape& s,
133  const Transform3<S>& tf1, const Transform3<S>& tf2,
134  const DistanceRequest<S>& request_,
135  DistanceResult<S>& result_) const;
136 
138  template <typename Shape>
139  void ShapeOcTreeDistance(const Shape& s, const OcTree<S>* tree,
140  const Transform3<S>& tf1, const Transform3<S>& tf2,
141  const DistanceRequest<S>& request_,
142  DistanceResult<S>& result_) const;
143 
144 private:
145 
146  template <typename Shape>
147  bool OcTreeShapeDistanceRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
148  const Shape& s, const AABB<S>& aabb2,
149  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
150 
151  template <typename Shape>
152  bool OcTreeShapeIntersectRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
153  const Shape& s, const OBB<S>& obb2,
154  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
155 
156  template <typename BV>
157  bool OcTreeMeshDistanceRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
158  const BVHModel<BV>* tree2, int root2,
159  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
160 
161 
162  template <typename BV>
163  bool OcTreeMeshIntersectRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
164  const BVHModel<BV>* tree2, int root2,
165  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
166 
167  bool OcTreeDistanceRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
168  const OcTree<S>* tree2, const typename OcTree<S>::OcTreeNode* root2, const AABB<S>& bv2,
169  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
170 
171 
172  bool OcTreeIntersectRecurse(const OcTree<S>* tree1, const typename OcTree<S>::OcTreeNode* root1, const AABB<S>& bv1,
173  const OcTree<S>* tree2, const typename OcTree<S>::OcTreeNode* root2, const AABB<S>& bv2,
174  const Transform3<S>& tf1, const Transform3<S>& tf2) const;
175 };
176 
177 } // namespace detail
178 } // namespace fcl
179 
181 
182 #endif
fcl::DistanceRequest
request to the distance computation
Definition: distance_request.h:52
fcl::detail::OcTreeSolver
Algorithms for collision related with octree.
Definition: octree_solver.h:59
fcl::Transform3
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
Definition: types.h:91
utility.h
fcl::detail::OcTreeSolver::crequest
const CollisionRequest< S > * crequest
Definition: octree_solver.h:67
fcl::AABB< S >
fcl::CollisionResult
collision result
Definition: collision_request.h:48
fcl::DistanceResult
distance result
Definition: distance_request.h:48
box.h
fcl::OBB< S >
octree_solver-inl.h
fcl::detail::OcTreeSolver::cresult
CollisionResult< S > * cresult
Definition: octree_solver.h:70
fcl::CollisionRequest
Parameters for performing collision request.
Definition: collision_request.h:52
fcl::detail::OcTreeSolver::solver
const NarrowPhaseSolver * solver
Definition: octree_solver.h:65
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
utility.h
fcl::detail::OcTreeSolver::S
typename NarrowPhaseSolver::S S
Definition: octree_solver.h:63
fcl::detail::OcTreeSolver::dresult
DistanceResult< S > * dresult
Definition: octree_solver.h:71
octree.h
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::detail::OcTreeSolver::drequest
const DistanceRequest< S > * drequest
Definition: octree_solver.h:68


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