default_broadphase_callbacks.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2020, Toyota Research Institute
5  * Copyright (c) 2022, INRIA
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 the copyright holder 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 
39 #ifndef HPP_FCL_BROADPHASE_DEFAULT_BROADPHASE_CALLBACKS_H
40 #define HPP_FCL_BROADPHASE_DEFAULT_BROADPHASE_CALLBACKS_H
41 
43 #include "hpp/fcl/collision.h"
44 #include "hpp/fcl/distance.h"
45 // #include "hpp/fcl/narrowphase/continuous_collision.h"
46 // #include "hpp/fcl/narrowphase/continuous_collision_request.h"
47 // #include "hpp/fcl/narrowphase/continuous_collision_result.h"
48 // #include "hpp/fcl/narrowphase/distance_request.h"
49 // #include "hpp/fcl/narrowphase/distance_result.h"
50 
51 namespace hpp {
52 namespace fcl {
53 
56 struct CollisionData {
57  CollisionData() { done = false; }
58 
61 
64 
66  bool done;
67 
69  void clear() {
70  result.clear();
71  done = false;
72  }
73 };
74 
77 struct DistanceData {
78  DistanceData() { done = false; }
79 
82 
85 
87  bool done;
88 
90  void clear() {
91  result.clear();
92  done = false;
93  }
94 };
95 
118 bool defaultCollisionFunction(CollisionObject* o1, CollisionObject* o2,
119  void* data);
120 
125 // struct DefaultContinuousCollisionData {
126 // ContinuousCollisionRequest request;
127 // ContinuousCollisionResult result;
128 //
129 // /// If `true`, requests that the broadphase evaluation stop.
130 // bool done{false};
131 // };
132 
155 // bool DefaultContinuousCollisionFunction(ContinuousCollisionObject* o1,
156 // ContinuousCollisionObject* o2,
157 // void* data) {
158 // assert(data != nullptr);
159 // auto* cdata = static_cast<DefaultContinuousCollisionData*>(data);
160 //
161 // if (cdata->done) return true;
162 //
163 // const ContinuousCollisionRequest& request = cdata->request;
164 // ContinuousCollisionResult& result = cdata->result;
165 // collide(o1, o2, request, result);
166 //
167 // return cdata->done;
168 // }
169 
192 bool defaultDistanceFunction(CollisionObject* o1, CollisionObject* o2,
193  void* data, FCL_REAL& dist);
194 
200  void init() { data.clear(); }
201 
202  bool collide(CollisionObject* o1, CollisionObject* o2);
203 
205 
207 };
208 
214  void init() { data.clear(); }
215 
216  bool distance(CollisionObject* o1, CollisionObject* o2, FCL_REAL& dist);
217 
219 
221 };
222 
225  typedef std::pair<CollisionObject*, CollisionObject*> CollisionPair;
226 
228  CollisionCallBackCollect(const size_t max_size);
229 
230  bool collide(CollisionObject* o1, CollisionObject* o2);
231 
233  size_t numCollisionPairs() const;
234 
236  const std::vector<CollisionPair>& getCollisionPairs() const;
237 
239  void init();
240 
242  bool exist(const CollisionPair& pair) const;
243 
245 
246  protected:
247  std::vector<CollisionPair> collision_pairs;
248  size_t max_size;
249 };
250 
251 } // namespace fcl
252 
253 } // namespace hpp
254 
255 #endif // HPP_FCL_BROADPHASE_DEFAULT_BROADPHASE_CALLBACKS_H
hpp::fcl::DistanceCallBackDefault::data
DistanceData data
Definition: default_broadphase_callbacks.h:218
hpp::fcl::CollisionData
Collision data stores the collision request and the result given by collision algorithm.
Definition: default_broadphase_callbacks.h:56
data
data
hpp::fcl::CollisionCallBackCollect::CollisionPair
std::pair< CollisionObject *, CollisionObject * > CollisionPair
Definition: default_broadphase_callbacks.h:225
hpp::fcl::CollisionCallBackCollect::~CollisionCallBackCollect
virtual ~CollisionCallBackCollect()
Definition: default_broadphase_callbacks.h:244
hpp::fcl::distance
HPP_FCL_DLLAPI FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
Definition: kIOS.cpp:181
hpp::fcl::DistanceCallBackDefault::init
void init()
Initialize the callback. Clears the distance result and sets the done boolean to false.
Definition: default_broadphase_callbacks.h:214
hpp::fcl::DistanceResult::clear
void clear()
clear the result
Definition: collision_data.h:504
hpp::fcl::collide
HPP_FCL_DLLAPI std::size_t collide(const CollisionObject *o1, const CollisionObject *o2, const CollisionRequest &request, CollisionResult &result)
Main collision interface: given two collision objects, and the requirements for contacts,...
Definition: src/collision.cpp:63
distance.h
hpp::fcl::FCL_REAL
double FCL_REAL
Definition: data_types.h:65
hpp::fcl::DistanceCallBackBase
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
Definition: broadphase_callbacks.h:73
hpp::fcl::DistanceCallBackDefault
Default distance callback to check collision between collision objects.
Definition: default_broadphase_callbacks.h:211
hpp::fcl::defaultDistanceFunction
bool defaultDistanceFunction(CollisionObject *o1, CollisionObject *o2, void *data, FCL_REAL &dist)
Collision data for use with the DefaultContinuousCollisionFunction. It stores the collision request a...
Definition: default_broadphase_callbacks.cpp:67
hpp::fcl::DistanceData::result
DistanceResult result
Distance result.
Definition: default_broadphase_callbacks.h:84
hpp::fcl::DistanceCallBackDefault::~DistanceCallBackDefault
virtual ~DistanceCallBackDefault()
Definition: default_broadphase_callbacks.h:220
hpp::fcl::CollisionCallBackDefault::init
void init()
Initialize the callback. Clears the collision result and sets the done boolean to false.
Definition: default_broadphase_callbacks.h:200
hpp::fcl::CollisionResult::clear
void clear()
clear the results obtained
Definition: collision_data.h:377
hpp
Main namespace.
Definition: broadphase_bruteforce.h:44
hpp::fcl::CollisionRequest
request to the collision algorithm
Definition: collision_data.h:235
hpp::fcl::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: collision_object.h:215
hpp::fcl::DistanceData::request
DistanceRequest request
Distance request.
Definition: default_broadphase_callbacks.h:81
hpp::fcl::CollisionData::CollisionData
CollisionData()
Definition: default_broadphase_callbacks.h:57
hpp::fcl::CollisionCallBackCollect
Collision callback to collect collision pairs potentially in contacts.
Definition: default_broadphase_callbacks.h:224
hpp::fcl::CollisionResult
collision result
Definition: collision_data.h:302
hpp::fcl::DistanceData::DistanceData
DistanceData()
Definition: default_broadphase_callbacks.h:78
hpp::fcl::DistanceData::done
bool done
Whether the distance iteration can stop.
Definition: default_broadphase_callbacks.h:87
broadphase_callbacks.h
hpp::fcl::CollisionCallBackDefault
Default collision callback to check collision between collision objects.
Definition: default_broadphase_callbacks.h:197
hpp::fcl::defaultCollisionFunction
bool defaultCollisionFunction(CollisionObject *o1, CollisionObject *o2, void *data)
Provides a simple callback for the collision query in the BroadPhaseCollisionManager....
Definition: default_broadphase_callbacks.cpp:43
hpp::fcl::DistanceRequest
request to the distance computation
Definition: collision_data.h:392
hpp::fcl::CollisionCallBackCollect::max_size
size_t max_size
Definition: default_broadphase_callbacks.h:248
hpp::fcl::DistanceData::clear
void clear()
Clears the DistanceData.
Definition: default_broadphase_callbacks.h:90
hpp::fcl::DistanceResult
distance result
Definition: collision_data.h:420
hpp::fcl::CollisionData::clear
void clear()
Clears the CollisionData.
Definition: default_broadphase_callbacks.h:69
hpp::fcl::CollisionCallBackBase
Base callback class for collision queries. This class can be supersed by child classes to provide des...
Definition: broadphase_callbacks.h:50
hpp::fcl::CollisionData::request
CollisionRequest request
Collision request.
Definition: default_broadphase_callbacks.h:60
hpp::fcl::CollisionData::done
bool done
Whether the collision iteration can stop.
Definition: default_broadphase_callbacks.h:66
hpp::fcl::DistanceData
Distance data stores the distance request and the result given by distance algorithm.
Definition: default_broadphase_callbacks.h:77
hpp::fcl::CollisionData::result
CollisionResult result
Collision result.
Definition: default_broadphase_callbacks.h:63
collision.h
hpp::fcl::CollisionCallBackDefault::data
CollisionData data
Definition: default_broadphase_callbacks.h:204
hpp::fcl::CollisionCallBackDefault::~CollisionCallBackDefault
virtual ~CollisionCallBackDefault()
Definition: default_broadphase_callbacks.h:206


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:13