hpp-fcl  3.0.0
HPP fork of FCL -- The Flexible Collision Library
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>
44 #include <hpp/fcl/collision_data.h>
46 #include <hpp/fcl/timings.h>
47 
48 namespace hpp {
49 namespace fcl {
50 
58 HPP_FCL_DLLAPI std::size_t collide(const CollisionObject* o1,
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 
80  public:
83 
84  std::size_t operator()(const Transform3f& tf1, const Transform3f& tf2,
85  const CollisionRequest& request,
86  CollisionResult& result) const;
87 
88  bool operator==(const ComputeCollision& other) const {
89  return o1 == other.o1 && o2 == other.o2 && solver == other.solver;
90  }
91 
92  bool operator!=(const ComputeCollision& other) const {
93  return !(*this == other);
94  }
95 
96  virtual ~ComputeCollision() {};
97 
98  protected:
99  // These pointers are made mutable to let the derived classes to update
100  // their values when updating the collision geometry (e.g. creating a new
101  // one). This feature should be used carefully to avoid any mis usage (e.g,
102  // changing the type of the collision geometry should be avoided).
103  mutable const CollisionGeometry* o1;
104  mutable const CollisionGeometry* o2;
105 
106  mutable GJKSolver solver;
107 
110 
111  virtual std::size_t run(const Transform3f& tf1, const Transform3f& tf2,
112  const CollisionRequest& request,
113  CollisionResult& result) const;
114 
115  public:
116  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
117 };
118 
119 } // namespace fcl
120 } // namespace hpp
121 
122 #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:79
CollisionFunctionMatrix::CollisionFunc func
Definition: collision.h:108
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:92
const CollisionGeometry * o2
Definition: collision.h:104
bool operator==(const ComputeCollision &other) const
Definition: collision.h:88
virtual ~ComputeCollision()
Definition: collision.h:96
GJKSolver solver
Definition: collision.h:106
ComputeCollision(const CollisionGeometry *o1, const CollisionGeometry *o2)
Default constructor from two Collision Geometries.
const CollisionGeometry * o1
Definition: collision.h:96
bool swap_geoms
Definition: collision.h:109
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:56
#define HPP_FCL_DLLAPI
Definition: config.hh:88
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
std::size_t(* CollisionFunc)(const CollisionGeometry *o1, const Transform3f &tf1, const CollisionGeometry *o2, const Transform3f &tf2, const GJKSolver *nsolver, const CollisionRequest &request, CollisionResult &result)
the uniform call interface for collision: for collision, we need know
Definition: collision_func_matrix.h:61
request to the collision algorithm
Definition: collision_data.h:312
collision result
Definition: collision_data.h:391
collision and distance solver based on the GJK and EPA algorithms. Originally, GJK and EPA were imple...
Definition: narrowphase.h:58