DART  6.7.3
CollisionFilter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
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  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_COLLISION_COLLISIONFILTER_HPP_
34 #define DART_COLLISION_COLLISIONFILTER_HPP_
35 
38 
39 namespace dart {
40 
41 namespace dynamics {
42 class BodyNode;
43 } // namespace dynamics
44 
45 namespace collision {
46 
47 class CollisionObject;
48 
50 {
51 public:
57  DART_DEPRECATED(6.3)
58  bool needCollision(
59  const CollisionObject* object1, const CollisionObject* object2) const;
60 
63  virtual bool ignoresCollision(
64  const CollisionObject* object1, const CollisionObject* object2) const = 0;
65 };
66 
68 {
69 public:
71  void addCollisionFilter(const CollisionFilter* filter);
72 
74  void removeCollisionFilter(const CollisionFilter* filter);
75 
78 
79  // Documentation inherited
80  bool ignoresCollision(
81  const CollisionObject* object1,
82  const CollisionObject* object2) const override;
83 
84 protected:
86  std::unordered_set<const CollisionFilter*> mFilters;
87 };
88 
90 {
91 public:
94  const dynamics::BodyNode* bodyNode1,
95  const dynamics::BodyNode* bodyNode2);
96 
99  const dynamics::BodyNode* bodyNode1,
100  const dynamics::BodyNode* bodyNode2);
101 
104 
105  // Documentation inherited
106  bool ignoresCollision(
107  const CollisionObject* object1,
108  const CollisionObject* object2) const override;
109 
110 private:
113  bool areAdjacentBodies(const dynamics::BodyNode* bodyNode1,
114  const dynamics::BodyNode* bodyNode2) const;
115 
118 };
119 
120 } // namespace collision
121 } // namespace dart
122 
123 #endif // DART_COLLISION_COLLISIONFILTER_HPP_
#define DART_DEPRECATED(version)
Definition: Deprecated.hpp:51
Definition: CollisionFilter.hpp:90
void addBodyNodePairToBlackList(const dynamics::BodyNode *bodyNode1, const dynamics::BodyNode *bodyNode2)
Add a BodyNode pair to the blacklist.
Definition: CollisionFilter.cpp:85
bool ignoresCollision(const CollisionObject *object1, const CollisionObject *object2) const override
Returns true if the given two CollisionObjects should be checked by the collision detector,...
Definition: CollisionFilter.cpp:105
void removeAllBodyNodePairsFromBlackList()
Remove all the BodyNode pairs from the blacklist.
Definition: CollisionFilter.cpp:99
detail::UnorderedPairs< dynamics::BodyNode > mBodyNodeBlackList
List of pairs to be ignored in the collision detection.
Definition: CollisionFilter.hpp:117
void removeBodyNodePairFromBlackList(const dynamics::BodyNode *bodyNode1, const dynamics::BodyNode *bodyNode2)
Remove a BodyNode pair from the blacklist.
Definition: CollisionFilter.cpp:92
bool areAdjacentBodies(const dynamics::BodyNode *bodyNode1, const dynamics::BodyNode *bodyNode2) const
Returns true if the two BodyNodes are adjacent BodyNodes (i.e., the two BodyNodes are connected by a ...
Definition: CollisionFilter.cpp:153
Definition: CollisionFilter.hpp:50
bool needCollision(const CollisionObject *object1, const CollisionObject *object2) const
Returns true if the given two CollisionObjects should be checked by the collision detector,...
Definition: CollisionFilter.cpp:42
virtual bool ignoresCollision(const CollisionObject *object1, const CollisionObject *object2) const =0
Returns true if the given two CollisionObjects should be checked by the collision detector,...
Definition: CollisionObject.hpp:45
Definition: CollisionFilter.hpp:68
void addCollisionFilter(const CollisionFilter *filter)
Adds a collision filter to this CompositeCollisionFilter.
Definition: CollisionFilter.cpp:49
bool ignoresCollision(const CollisionObject *object1, const CollisionObject *object2) const override
Returns true if the given two CollisionObjects should be checked by the collision detector,...
Definition: CollisionFilter.cpp:72
void removeAllCollisionFilters()
Removes all the collision filters from this CompositeCollisionFilter.
Definition: CollisionFilter.cpp:66
void removeCollisionFilter(const CollisionFilter *filter)
Removes a collision filter from this CompositeCollisionFilter.
Definition: CollisionFilter.cpp:59
std::unordered_set< const CollisionFilter * > mFilters
Collision filters.
Definition: CollisionFilter.hpp:86
Definition: UnorderedPairs.hpp:45
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:78
::fcl::CollisionObject CollisionObject
Definition: BackwardCompatibility.hpp:152
Definition: BulletCollisionDetector.cpp:63