38 #ifndef FCL_TRAVERSAL_SHAPECOLLISIONTRAVERSALNODE_INL_H 39 #define FCL_TRAVERSAL_SHAPECOLLISIONTRAVERSALNODE_INL_H 41 #include "fcl/narrowphase/detail/traversal/collision/shape_collision_traversal_node.h" 50 template <
typename Shape1,
typename Shape2,
typename NarrowPhaseSolver>
51 ShapeCollisionTraversalNode<Shape1, Shape2, NarrowPhaseSolver>::
52 ShapeCollisionTraversalNode()
53 : CollisionTraversalNodeBase<typename Shape1::S>()
62 template <
typename Shape1,
typename Shape2,
typename NarrowPhaseSolver>
70 template <
typename Shape1,
typename Shape2,
typename NarrowPhaseSolver>
74 if(model1->isOccupied() && model2->isOccupied())
76 bool is_collision =
false;
79 std::vector<ContactPoint<S>> contacts;
80 if(nsolver->shapeIntersect(*model1, this->tf1, *model2, this->tf2, &contacts))
86 size_t num_adding_contacts;
89 if (free_space < contacts.size())
91 std::partial_sort(contacts.begin(), contacts.begin() + free_space, contacts.end(), std::bind(comparePenDepth<S>, std::placeholders::_2, std::placeholders::_1));
92 num_adding_contacts = free_space;
96 num_adding_contacts = contacts.size();
99 for(
size_t i = 0; i < num_adding_contacts; ++i)
106 if(nsolver->shapeIntersect(*model1, this->tf1, *model2, this->tf2,
nullptr))
120 aabb1.
overlap(aabb2, overlap_part);
126 if(nsolver->shapeIntersect(*model1, this->tf1, *model2, this->tf2,
nullptr))
132 aabb1.
overlap(aabb2, overlap_part);
139 template <
typename Shape1,
typename Shape2,
typename NarrowPhaseSolver>
142 const Shape1& shape1,
143 const Transform3<typename Shape1::S>&
tf1,
144 const Shape2& shape2,
145 const Transform3<typename Shape1::S>&
tf2,
146 const NarrowPhaseSolver* nsolver,
150 node.model1 = &shape1;
152 node.model2 = &shape2;
154 node.nsolver = nsolver;
159 node.cost_density = shape1.cost_density * shape2.cost_density;
bool enable_cost
whether the cost sources will be computed
Definition: collision_request.h:64
void addCostSource(const CostSource< S > &c, std::size_t num_max_cost_sources)
add one cost source into result structure
Definition: collision_result-inl.h:66
size_t num_max_contacts
The maximum number of contacts will return.
Definition: collision_request.h:55
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
collision result
Definition: collision_request.h:48
void leafTesting(int, int) const
Intersection testing between leaves (two shapes)
Definition: shape_collision_traversal_node-inl.h:72
Transform3< BV::S > tf2
configuration of second object
Definition: traversal_node_base.h:88
size_t numContacts() const
number of contacts found
Definition: collision_result-inl.h:83
bool overlap(const AABB< S > &other) const
Check whether two AABB are overlap.
Definition: AABB-inl.h:98
CollisionRequest< BV::S > request
request setting for collision
Definition: collision_traversal_node_base.h:72
bool BVTesting(int, int) const
BV culling test in one BVTT node.
Definition: shape_collision_traversal_node-inl.h:64
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return ...
Definition: collision_request.h:58
request to the collision algorithm
Definition: collision_request.h:52
size_t num_max_cost_sources
The maximum number of cost sources will return.
Definition: collision_request.h:61
void computeBV(const Shape &s, const Transform3< typename BV::S > &tf, BV &bv)
calculate a bounding volume for a shape in a specific configuration
Definition: utility-inl.h:1049
CollisionResult< BV::S > * result
collision result kept during the traversal iteration
Definition: collision_traversal_node_base.h:75
Traversal node for collision between two shapes.
Definition: shape_collision_traversal_node.h:53
Transform3< BV::S > tf1
configuation of first object
Definition: traversal_node_base.h:85
Cost source describes an area with a cost. The area is described by an AABB<S> region.
Definition: cost_source.h:49
void addContact(const Contact< S > &c)
add one contact into result structure
Definition: collision_result-inl.h:59