contact_patch.cc
Go to the documentation of this file.
1 //
2 // Software License Agreement (BSD License)
3 //
4 // Copyright (c) 2024 INRIA
5 // Author: Louis Montaut
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
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 // * Neither the name of INRIA nor the names of its
19 // contributors may be used to endorse or promote products derived
20 // from this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 // POSSIBILITY OF SUCH DAMAGE.
34 
35 #include <eigenpy/eigenpy.hpp>
36 
37 #include "coal/fwd.hh"
38 #include "coal/contact_patch.h"
40 
41 #include "coal.hh"
42 #include "deprecation.hh"
43 #include "serializable.hh"
44 
45 #ifdef COAL_HAS_DOXYGEN_AUTODOC
46 #include "doxygen_autodoc/functions.h"
47 #include "doxygen_autodoc/coal/collision_data.h"
48 #endif
49 
50 #include "../doc/python/doxygen.hh"
51 #include "../doc/python/doxygen-boost.hh"
52 
53 using namespace boost::python;
54 using namespace coal;
55 using namespace coal::python;
56 
57 namespace dv = doxygen::visitor;
58 
62  enum_<ContactPatch::PatchDirection>("ContactPatchDirection")
63  .value("DEFAULT", ContactPatch::PatchDirection::DEFAULT)
64  .value("INVERTED", ContactPatch::PatchDirection::INVERTED)
65  .export_values();
66  }
67 
68  if (!eigenpy::register_symbolic_link_to_registered_type<ContactPatch>()) {
69  class_<ContactPatch>(
70  "ContactPatch", doxygen::class_doc<ContactPatch>(),
71  init<optional<size_t>>((arg("self"), arg("preallocated_size")),
72  "ContactPatch constructor."))
73  .DEF_RW_CLASS_ATTRIB(ContactPatch, tf)
74  .DEF_RW_CLASS_ATTRIB(ContactPatch, direction)
75  .DEF_RW_CLASS_ATTRIB(ContactPatch, penetration_depth)
76  .DEF_CLASS_FUNC(ContactPatch, size)
77  .DEF_CLASS_FUNC(ContactPatch, getNormal)
78  .DEF_CLASS_FUNC(ContactPatch, addPoint)
79  .DEF_CLASS_FUNC(ContactPatch, getPoint)
80  .DEF_CLASS_FUNC(ContactPatch, getPointShape1)
81  .DEF_CLASS_FUNC(ContactPatch, getPointShape2)
82  .DEF_CLASS_FUNC(ContactPatch, clear)
83  .DEF_CLASS_FUNC(ContactPatch, isSame);
84  }
85 
87  std::vector<ContactPatch>>()) {
88  class_<std::vector<ContactPatch>>("StdVec_ContactPatch")
89  .def(vector_indexing_suite<std::vector<ContactPatch>>());
90  }
91 
94  class_<ContactPatchRequest>(
95  "ContactPatchRequest", doxygen::class_doc<ContactPatchRequest>(),
96  init<optional<size_t, size_t, CoalScalar>>(
97  (arg("self"), arg("max_num_patch"),
98  arg("num_samples_curved_shapes"), arg("patch_tolerance")),
99  "ContactPatchRequest constructor."))
100  .def(dv::init<ContactPatchRequest, const CollisionRequest&,
101  bp::optional<size_t, CoalScalar>>())
102  .DEF_RW_CLASS_ATTRIB(ContactPatchRequest, max_num_patch)
103  .DEF_CLASS_FUNC(ContactPatchRequest, getNumSamplesCurvedShapes)
104  .DEF_CLASS_FUNC(ContactPatchRequest, setNumSamplesCurvedShapes)
105  .DEF_CLASS_FUNC(ContactPatchRequest, getPatchTolerance)
106  .DEF_CLASS_FUNC(ContactPatchRequest, setPatchTolerance);
107  }
108 
110  std::vector<ContactPatchRequest>>()) {
111  class_<std::vector<ContactPatchRequest>>("StdVec_ContactPatchRequest")
112  .def(vector_indexing_suite<std::vector<ContactPatchRequest>>());
113  }
114 
116  ContactPatchResult>()) {
117  class_<ContactPatchResult>("ContactPatchResult",
118  doxygen::class_doc<ContactPatchResult>(),
119  init<>(arg("self"), "Default constructor."))
120  .def(dv::init<ContactPatchResult, ContactPatchRequest>())
121  .DEF_CLASS_FUNC(ContactPatchResult, numContactPatches)
122  .DEF_CLASS_FUNC(ContactPatchResult, getUnusedContactPatch)
123  .DEF_CLASS_FUNC2(ContactPatchResult, getContactPatch,
124  return_value_policy<copy_const_reference>())
125  .DEF_CLASS_FUNC(ContactPatchResult, clear)
126  .DEF_CLASS_FUNC(ContactPatchResult, set)
127  .DEF_CLASS_FUNC(ContactPatchResult, check);
128  }
129 
131  std::vector<ContactPatchResult>>()) {
132  class_<std::vector<ContactPatchResult>>("StdVec_ContactPatchResult")
133  .def(vector_indexing_suite<std::vector<ContactPatchResult>>());
134  }
135 
136  doxygen::def(
137  "computeContactPatch",
138  static_cast<void (*)(const CollisionObject*, const CollisionObject*,
139  const CollisionResult&, const ContactPatchRequest&,
141  doxygen::def(
142  "computeContactPatch",
143  static_cast<void (*)(const CollisionGeometry*, const Transform3s&,
144  const CollisionGeometry*, const Transform3s&,
145  const CollisionResult&, const ContactPatchRequest&,
147 
149  ComputeContactPatch>()) {
150  class_<ComputeContactPatch>("ComputeContactPatch",
151  doxygen::class_doc<ComputeContactPatch>(),
152  no_init)
153  .def(dv::init<ComputeContactPatch, const CollisionGeometry*,
154  const CollisionGeometry*>())
155  .def("__call__",
156  static_cast<void (ComputeContactPatch::*)(
157  const Transform3s&, const Transform3s&, const CollisionResult&,
158  const ContactPatchRequest&, ContactPatchResult&) const>(
159  &ComputeContactPatch::operator()));
160  }
161 }
boost::python
exposeContactPatchAPI
void exposeContactPatchAPI()
Definition: contact_patch.cc:59
coal.hh
eigenpy.hpp
eigenpy::register_symbolic_link_to_registered_type
bool register_symbolic_link_to_registered_type()
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
doxygen::visitor
Definition: doxygen-boost.hh:12
doxygen::def
void def(const char *name, Func func)
Definition: doxygen-boost.hh:106
coal::ContactPatch
This structure allows to encode contact patches. A contact patch is defined by a set of points belong...
Definition: coal/collision_data.h:512
coal::CollisionGeometry
The geometry for the object for collision or distance computation.
Definition: coal/collision_object.h:94
check
bool check(const T &value, const T &other)
Definition: test/serialization.cpp:77
serializable.hh
coal::Transform3s
Simple transform class used locally by InterpMotion.
Definition: coal/math/transform.h:55
contact_patch.h
coal::python
Definition: python/broadphase/fwd.hh:11
fwd.hh
coal::CollisionResult
collision result
Definition: coal/collision_data.h:390
deprecation.hh
coal::computeContactPatch
COAL_DLLAPI void computeContactPatch(const CollisionGeometry *o1, const Transform3s &tf1, const CollisionGeometry *o2, const Transform3s &tf2, const CollisionResult &collision_result, const ContactPatchRequest &request, ContactPatchResult &result)
Main contact patch computation interface.
Definition: src/contact_patch.cpp:47
coal::CollisionRequest
request to the collision algorithm
Definition: coal/collision_data.h:311
coal::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: coal/collision_object.h:214
coal::ContactPatchResult
Result for a contact patch computation.
Definition: coal/collision_data.h:822
coal::ContactPatchRequest
Request for a contact patch computation.
Definition: coal/collision_data.h:724
collision_data.h
coal::ContactPatch::PatchDirection
PatchDirection
Direction of ContactPatch. When doing collision detection, the convention of Coal is that the normal ...
Definition: coal/collision_data.h:529
coal::ComputeContactPatch
This class reduces the cost of identifying the geometry pair. This is usefull for repeated shape-shap...
Definition: coal/contact_patch.h:77


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