hpp-fcl 2.2.0
HPP fork of FCL -- The Flexible Collision Library
Loading...
Searching...
No Matches
collision.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-2015, Open Source Robotics Foundation
6 * Copyright (c) 2021, INRIA
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of Open Source Robotics Foundation nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
39#ifndef HPP_FCL_COLLISION_H
40#define HPP_FCL_COLLISION_H
41
42#include <hpp/fcl/data_types.h>
46#include <hpp/fcl/timings.h>
47
48namespace hpp {
49namespace fcl {
50
59 const CollisionObject* o2,
60 const CollisionRequest& request,
61 CollisionResult& result);
62
66 const Transform3f& tf1,
67 const CollisionGeometry* o2,
68 const Transform3f& tf2,
69 const CollisionRequest& request,
70 CollisionResult& result);
71
76inline std::size_t collide(const CollisionObject* o1, const CollisionObject* o2,
77 CollisionRequest& request, CollisionResult& result) {
78 std::size_t res = collide(o1, o2, (const CollisionRequest&)request, result);
79 request.updateGuess(result);
80 return res;
81}
82
87inline std::size_t collide(const CollisionGeometry* o1, const Transform3f& tf1,
88 const CollisionGeometry* o2, const Transform3f& tf2,
89 CollisionRequest& request, CollisionResult& result) {
90 std::size_t res =
91 collide(o1, tf1, o2, tf2, (const CollisionRequest&)request, result);
92 request.updateGuess(result);
93 return res;
94}
95
104 public:
107
108 std::size_t operator()(const Transform3f& tf1, const Transform3f& tf2,
109 const CollisionRequest& request,
110 CollisionResult& result) const;
111
112 inline std::size_t operator()(const Transform3f& tf1, const Transform3f& tf2,
113 CollisionRequest& request,
114 CollisionResult& result) const {
115 std::size_t res = operator()(tf1, tf2, (const CollisionRequest&)request,
116 result);
117 request.updateGuess(result);
118 return res;
119 }
120
121 bool operator==(const ComputeCollision& other) const {
122 return o1 == other.o1 && o2 == other.o2 && solver == other.solver;
123 }
124
125 bool operator!=(const ComputeCollision& other) const {
126 return !(*this == other);
127 }
128
129 virtual ~ComputeCollision(){};
130
131 protected:
132 // These pointers are made mutable to let the derived classes to update
133 // their values when updating the collision geometry (e.g. creating a new
134 // one). This feature should be used carefully to avoid any mis usage (e.g,
135 // changing the type of the collision geometry should be avoided).
136 mutable const CollisionGeometry* o1;
137 mutable const CollisionGeometry* o2;
138
140
141 CollisionFunctionMatrix::CollisionFunc func;
143
144 virtual std::size_t run(const Transform3f& tf1, const Transform3f& tf2,
145 const CollisionRequest& request,
146 CollisionResult& result) const;
147
148 public:
149 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
150};
151
152} // namespace fcl
153} // namespace hpp
154
155#endif
The geometry for the object for collision or distance computation.
Definition: collision_object.h:95
the object for collision or distance computation, contains the geometry and the transform information
Definition: collision_object.h:215
This class reduces the cost of identifying the geometry pair. This is mostly useful for repeated shap...
Definition: collision.h:103
CollisionFunctionMatrix::CollisionFunc func
Definition: collision.h:141
virtual std::size_t run(const Transform3f &tf1, const Transform3f &tf2, const CollisionRequest &request, CollisionResult &result) const
bool operator!=(const ComputeCollision &other) const
Definition: collision.h:125
const CollisionGeometry * o2
Definition: collision.h:137
bool operator==(const ComputeCollision &other) const
Definition: collision.h:121
std::size_t operator()(const Transform3f &tf1, const Transform3f &tf2, CollisionRequest &request, CollisionResult &result) const
Definition: collision.h:112
virtual ~ComputeCollision()
Definition: collision.h:129
GJKSolver solver
Definition: collision.h:139
ComputeCollision(const CollisionGeometry *o1, const CollisionGeometry *o2)
Default constructor from two Collision Geometries.
const CollisionGeometry * o1
Definition: collision.h:136
bool swap_geoms
Definition: collision.h:142
std::size_t operator()(const Transform3f &tf1, const Transform3f &tf2, const CollisionRequest &request, CollisionResult &result) const
Simple transform class used locally by InterpMotion.
Definition: transform.h:54
#define HPP_FCL_DLLAPI
Definition: config.hh:64
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,...
Main namespace.
Definition: broadphase_bruteforce.h:44
request to the collision algorithm
Definition: collision_data.h:235
collision result
Definition: collision_data.h:302
collision and distance solver based on GJK algorithm implemented in fcl (rewritten the code from the ...
Definition: narrowphase.h:54
void updateGuess(const QueryResult &result)
Definition: collision_data.h:210