coal/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 COAL_COLLISION_H
40 #define COAL_COLLISION_H
41 
42 #include "coal/data_types.h"
43 #include "coal/collision_object.h"
44 #include "coal/collision_data.h"
46 #include "coal/timings.h"
47 
48 namespace coal {
49 
57 COAL_DLLAPI std::size_t collide(const CollisionObject* o1,
58  const CollisionObject* o2,
59  const CollisionRequest& request,
60  CollisionResult& result);
61 
64 COAL_DLLAPI std::size_t collide(const CollisionGeometry* o1,
65  const Transform3s& tf1,
66  const CollisionGeometry* o2,
67  const Transform3s& tf2,
68  const CollisionRequest& request,
69  CollisionResult& result);
70 
78 class COAL_DLLAPI ComputeCollision {
79  public:
82 
83  std::size_t operator()(const Transform3s& tf1, const Transform3s& tf2,
84  const CollisionRequest& request,
85  CollisionResult& result) const;
86 
87  bool operator==(const ComputeCollision& other) const {
88  return o1 == other.o1 && o2 == other.o2 && solver == other.solver;
89  }
90 
91  bool operator!=(const ComputeCollision& other) const {
92  return !(*this == other);
93  }
94 
95  virtual ~ComputeCollision() {};
96 
97  protected:
98  // These pointers are made mutable to let the derived classes to update
99  // their values when updating the collision geometry (e.g. creating a new
100  // one). This feature should be used carefully to avoid any mis usage (e.g,
101  // changing the type of the collision geometry should be avoided).
102  mutable const CollisionGeometry* o1;
103  mutable const CollisionGeometry* o2;
104 
105  mutable GJKSolver solver;
106 
109 
110  virtual std::size_t run(const Transform3s& tf1, const Transform3s& tf2,
111  const CollisionRequest& request,
112  CollisionResult& result) const;
113 
114  public:
115  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
116 };
117 
118 } // namespace coal
119 
120 #endif
coal::ComputeCollision::o1
const CollisionGeometry * o1
Definition: coal/collision.h:95
coal::ComputeCollision::~ComputeCollision
virtual ~ComputeCollision()
Definition: coal/collision.h:95
gjk.tf1
tuple tf1
Definition: test/scripts/gjk.py:27
collision_data.h
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::GJKSolver
collision and distance solver based on the GJK and EPA algorithms. Originally, GJK and EPA were imple...
Definition: coal/narrowphase/narrowphase.h:57
collision_object.h
coal::CollisionGeometry
The geometry for the object for collision or distance computation.
Definition: coal/collision_object.h:94
coal::Transform3s
Simple transform class used locally by InterpMotion.
Definition: coal/math/transform.h:55
coal::ComputeCollision::solver
GJKSolver solver
Definition: coal/collision.h:105
coal::ComputeCollision::operator==
bool operator==(const ComputeCollision &other) const
Definition: coal/collision.h:87
coal::ComputeCollision::swap_geoms
bool swap_geoms
Definition: coal/collision.h:108
coal::CollisionResult
collision result
Definition: coal/collision_data.h:390
coal::ComputeCollision::o2
const CollisionGeometry * o2
Definition: coal/collision.h:103
coal::CollisionRequest
request to the collision algorithm
Definition: coal/collision_data.h:311
gjk.tf2
tuple tf2
Definition: test/scripts/gjk.py:36
omniidl_be_python_with_docstring.run
def run(tree, args)
Definition: omniidl_be_python_with_docstring.py:140
collision_func_matrix.h
coal::collide
COAL_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:61
timings.h
coal::ComputeCollision::operator!=
bool operator!=(const ComputeCollision &other) const
Definition: coal/collision.h:91
data_types.h
coal::ComputeCollision::func
CollisionFunctionMatrix::CollisionFunc func
Definition: coal/collision.h:107
coal::CollisionFunctionMatrix::CollisionFunc
std::size_t(* CollisionFunc)(const CollisionGeometry *o1, const Transform3s &tf1, const CollisionGeometry *o2, const Transform3s &tf2, const GJKSolver *nsolver, const CollisionRequest &request, CollisionResult &result)
the uniform call interface for collision: for collision, we need know
Definition: coal/collision_func_matrix.h:60
coal::ComputeCollision
This class reduces the cost of identifying the geometry pair. This is mostly useful for repeated shap...
Definition: coal/collision.h:78


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:57