serialization/collision_data.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
5 #ifndef HPP_FCL_SERIALIZATION_COLLISION_DATA_H
6 #define HPP_FCL_SERIALIZATION_COLLISION_DATA_H
7 
10 
11 namespace boost {
12 namespace serialization {
13 
14 template <class Archive>
15 void save(Archive& ar, const hpp::fcl::Contact& contact,
16  const unsigned int /*version*/) {
17  ar& make_nvp("b1", contact.b1);
18  ar& make_nvp("b2", contact.b2);
19  ar& make_nvp("normal", contact.normal);
20  ar& make_nvp("pos", contact.pos);
21  ar& make_nvp("penetration_depth", contact.penetration_depth);
22 }
23 
24 template <class Archive>
25 void load(Archive& ar, hpp::fcl::Contact& contact,
26  const unsigned int /*version*/) {
27  ar >> make_nvp("b1", contact.b1);
28  ar >> make_nvp("b2", contact.b2);
29  ar >> make_nvp("normal", contact.normal);
30  ar >> make_nvp("pos", contact.pos);
31  ar >> make_nvp("penetration_depth", contact.penetration_depth);
32  contact.o1 = NULL;
33  contact.o2 = NULL;
34 }
35 
37 
38 template <class Archive>
39 void serialize(Archive& ar, hpp::fcl::QueryRequest& query_request,
40  const unsigned int /*version*/) {
41  ar& make_nvp("gjk_initial_guess", query_request.gjk_initial_guess);
42  // TODO: use gjk_initial_guess instead
45  ar& make_nvp("enable_cached_gjk_guess",
46  query_request.enable_cached_gjk_guess);
48  ar& make_nvp("cached_gjk_guess", query_request.cached_gjk_guess);
49  ar& make_nvp("cached_support_func_guess",
50  query_request.cached_support_func_guess);
51  ar& make_nvp("enable_timings", query_request.enable_timings);
52 }
53 
54 template <class Archive>
55 void serialize(Archive& ar, hpp::fcl::QueryResult& query_result,
56  const unsigned int /*version*/) {
57  ar& make_nvp("cached_gjk_guess", query_result.cached_gjk_guess);
58  ar& make_nvp("cached_support_func_guess",
59  query_result.cached_support_func_guess);
60 }
61 
62 template <class Archive>
63 void serialize(Archive& ar, hpp::fcl::CollisionRequest& collision_request,
64  const unsigned int /*version*/) {
65  ar& make_nvp("base",
66  boost::serialization::base_object<hpp::fcl::QueryRequest>(
67  collision_request));
68  ar& make_nvp("num_max_contacts", collision_request.num_max_contacts);
69  ar& make_nvp("enable_contact", collision_request.enable_contact);
70  ar& make_nvp("enable_distance_lower_bound",
71  collision_request.enable_distance_lower_bound);
72  ar& make_nvp("security_margin", collision_request.security_margin);
73  ar& make_nvp("break_distance", collision_request.break_distance);
74 }
75 
76 template <class Archive>
77 void save(Archive& ar, const hpp::fcl::CollisionResult& collision_result,
78  const unsigned int /*version*/) {
79  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>(
80  collision_result));
81  ar& make_nvp("contacts", collision_result.getContacts());
82  ar& make_nvp("distance_lower_bound", collision_result.distance_lower_bound);
83 }
84 
85 template <class Archive>
86 void load(Archive& ar, hpp::fcl::CollisionResult& collision_result,
87  const unsigned int /*version*/) {
88  ar >>
89  make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>(
90  collision_result));
91  std::vector<hpp::fcl::Contact> contacts;
92  ar >> make_nvp("contacts", contacts);
93  collision_result.clear();
94  for (size_t k = 0; k < contacts.size(); ++k)
95  collision_result.addContact(contacts[k]);
96  ar >> make_nvp("distance_lower_bound", collision_result.distance_lower_bound);
97 }
98 
100 
101 template <class Archive>
102 void serialize(Archive& ar, hpp::fcl::DistanceRequest& distance_request,
103  const unsigned int /*version*/) {
104  ar& make_nvp("base",
105  boost::serialization::base_object<hpp::fcl::QueryRequest>(
106  distance_request));
107  ar& make_nvp("enable_nearest_points", distance_request.enable_nearest_points);
108  ar& make_nvp("rel_err", distance_request.rel_err);
109  ar& make_nvp("abs_err", distance_request.abs_err);
110 }
111 
112 template <class Archive>
113 void save(Archive& ar, const hpp::fcl::DistanceResult& distance_result,
114  const unsigned int /*version*/) {
115  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>(
116  distance_result));
117  ar& make_nvp("min_distance", distance_result.min_distance);
118  ar& make_nvp("nearest_points", make_array(distance_result.nearest_points, 2));
119  ar& make_nvp("normal", distance_result.normal);
120  ar& make_nvp("b1", distance_result.b1);
121  ar& make_nvp("b2", distance_result.b2);
122 }
123 
124 template <class Archive>
125 void load(Archive& ar, hpp::fcl::DistanceResult& distance_result,
126  const unsigned int /*version*/) {
127  ar >>
128  make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>(
129  distance_result));
130  ar >> make_nvp("min_distance", distance_result.min_distance);
131  ar >>
132  make_nvp("nearest_points", make_array(distance_result.nearest_points, 2));
133  ar >> make_nvp("normal", distance_result.normal);
134  ar >> make_nvp("b1", distance_result.b1);
135  ar >> make_nvp("b2", distance_result.b2);
136  distance_result.o1 = NULL;
137  distance_result.o2 = NULL;
138 }
139 
141 
142 } // namespace serialization
143 } // namespace boost
144 
145 #endif // ifndef HPP_FCL_SERIALIZATION_COLLISION_DATA_H
support_func_guess_t cached_support_func_guess
the support function initial guess set by user
size_t num_max_contacts
The maximum number of contacts will return.
GJKInitialGuess gjk_initial_guess
request to the distance computation
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
const CollisionGeometry * o1
collision object 1
base class for all query results
#define HPP_FCL_SERIALIZATION_SPLIT(Type)
Definition: fwd.h:13
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if object 2 is geometry shape, it is NONE (-1), if object 2 is octree, it is the id of the cell
Vec3f nearest_points[2]
nearest points
bool enable_cached_gjk_guess
whether enable gjk initial guess Use gjk_initial_guess instead
void addContact(const Contact &c)
add one contact into result structure
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
const CollisionGeometry * o1
collision object 1
#define HPP_FCL_COMPILER_DIAGNOSTIC_POP
#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
request to the collision algorithm
void clear()
clear the results obtained
FCL_REAL penetration_depth
penetration depth
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0...
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if object 1 is geometry shape, it is NONE (-1), if object 1 is octree, it is the id of the cell
Vec3f normal
In case both objects are in collision, store the normal.
void save(Archive &ar, const hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Vec3f cached_gjk_guess
the gjk initial guess set by user
Vec3f pos
contact position, in world space
bool enable_timings
enable timings when performing collision/distance request
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision.
FCL_REAL rel_err
error threshold for approximate distance
bool enable_nearest_points
whether to return the nearest points
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
int b1
contact primitive in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if o...
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return ...
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
base class for all query requests
#define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH
const CollisionGeometry * o2
collision object 2
Contact information returned by collision.
int b2
contact primitive in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if o...
void load(Archive &ar, hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
Vec3f normal
contact normal, pointing from o1 to o2
const CollisionGeometry * o2
collision object 2
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:00