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
hpp::fcl::DistanceResult::b2
int b2
information about the nearest point in object 2 if object 2 is mesh or point cloud,...
Definition: collision_data.h:448
hpp::fcl::CollisionResult::addContact
void addContact(const Contact &c)
add one contact into result structure
Definition: collision_data.h:330
hpp::fcl::CollisionRequest::break_distance
FCL_REAL break_distance
Distance below which bounding volumes are broken down. See Collision.
Definition: collision_data.h:255
HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
#define HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
Definition: include/hpp/fcl/fwd.hh:84
hpp::fcl::DistanceResult::nearest_points
Vec3f nearest_points[2]
nearest points
Definition: collision_data.h:427
hpp::fcl::CollisionRequest::enable_distance_lower_bound
bool enable_distance_lower_bound
Whether a lower bound on distance is returned when objects are disjoint.
Definition: collision_data.h:244
HPP_FCL_SERIALIZATION_SPLIT
#define HPP_FCL_SERIALIZATION_SPLIT(Type)
Definition: fwd.h:13
hpp::fcl::Contact::b1
int b1
contact primitive in object 1 if object 1 is mesh or point cloud, it is the triangle or point id if o...
Definition: collision_data.h:65
fwd.h
hpp::fcl::QueryResult
base class for all query results
Definition: collision_data.h:195
boost
hpp::fcl::DistanceResult::o1
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:433
hpp::fcl::QueryRequest::gjk_initial_guess
GJKInitialGuess gjk_initial_guess
Definition: collision_data.h:121
hpp::fcl::Contact::b2
int b2
contact primitive in object 2 if object 2 is mesh or point cloud, it is the triangle or point id if o...
Definition: collision_data.h:71
hpp::fcl::DistanceRequest::abs_err
FCL_REAL abs_err
Definition: collision_data.h:398
boost::serialization::load
void load(Archive &ar, hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
Definition: serialization/BV_splitter.h:44
hpp::fcl::QueryRequest::enable_timings
bool enable_timings
enable timings when performing collision/distance request
Definition: collision_data.h:150
hpp::fcl::DistanceResult::normal
Vec3f normal
In case both objects are in collision, store the normal.
Definition: collision_data.h:430
hpp::fcl::DistanceResult::b1
int b1
information about the nearest point in object 1 if object 1 is mesh or point cloud,...
Definition: collision_data.h:442
hpp::fcl::CollisionRequest::security_margin
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.
Definition: collision_data.h:251
hpp::fcl::CollisionRequest::enable_contact
bool enable_contact
whether the contact information (normal, penetration depth and contact position) will return
Definition: collision_data.h:241
hpp::fcl::Contact::o2
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:59
collision_data.h
hpp::fcl::QueryRequest::cached_gjk_guess
Vec3f cached_gjk_guess
the gjk initial guess set by user
Definition: collision_data.h:144
hpp::fcl::Contact::normal
Vec3f normal
contact normal, pointing from o1 to o2
Definition: collision_data.h:74
HPP_FCL_COMPILER_DIAGNOSTIC_PUSH
#define HPP_FCL_COMPILER_DIAGNOSTIC_PUSH
Definition: include/hpp/fcl/fwd.hh:82
hpp::fcl::CollisionResult::clear
void clear()
clear the results obtained
Definition: collision_data.h:377
hpp::fcl::CollisionRequest
request to the collision algorithm
Definition: collision_data.h:235
hpp::fcl::QueryResult::cached_gjk_guess
Vec3f cached_gjk_guess
stores the last GJK ray when relevant.
Definition: collision_data.h:197
hpp::fcl::CollisionResult
collision result
Definition: collision_data.h:302
hpp::fcl::DistanceResult::min_distance
FCL_REAL min_distance
minimum distance between two objects. if two objects are in collision, min_distance <= 0.
Definition: collision_data.h:424
hpp::fcl::QueryRequest::enable_cached_gjk_guess
bool enable_cached_gjk_guess
whether enable gjk initial guess @Deprecated Use gjk_initial_guess instead
Definition: collision_data.h:126
hpp::fcl::CollisionRequest::num_max_contacts
size_t num_max_contacts
The maximum number of contacts will return.
Definition: collision_data.h:237
hpp::fcl::QueryRequest::cached_support_func_guess
support_func_guess_t cached_support_func_guess
the support function initial guess set by user
Definition: collision_data.h:147
hpp::fcl::DistanceRequest
request to the distance computation
Definition: collision_data.h:392
hpp::fcl::DistanceRequest::rel_err
FCL_REAL rel_err
error threshold for approximate distance
Definition: collision_data.h:397
hpp::fcl::DistanceResult
distance result
Definition: collision_data.h:420
hpp::fcl::DistanceResult::o2
const CollisionGeometry * o2
collision object 2
Definition: collision_data.h:436
HPP_FCL_COMPILER_DIAGNOSTIC_POP
#define HPP_FCL_COMPILER_DIAGNOSTIC_POP
Definition: include/hpp/fcl/fwd.hh:83
boost::serialization::serialize
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
Definition: serialization/AABB.h:15
hpp::fcl::QueryRequest
base class for all query requests
Definition: collision_data.h:119
hpp::fcl::DistanceRequest::enable_nearest_points
bool enable_nearest_points
whether to return the nearest points
Definition: collision_data.h:394
hpp::fcl::Contact::o1
const CollisionGeometry * o1
collision object 1
Definition: collision_data.h:56
hpp::fcl::CollisionResult::getContacts
void getContacts(std::vector< Contact > &contacts_) const
get all the contacts
Definition: collision_data.h:369
hpp::fcl::QueryResult::cached_support_func_guess
support_func_guess_t cached_support_func_guess
stores the last support function vertex index, when relevant.
Definition: collision_data.h:200
hpp::fcl::Contact::penetration_depth
FCL_REAL penetration_depth
penetration depth
Definition: collision_data.h:80
boost::serialization::save
void save(Archive &ar, const hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
Definition: serialization/BV_splitter.h:30
hpp::fcl::Contact::pos
Vec3f pos
contact position, in world space
Definition: collision_data.h:77
hpp::fcl::CollisionResult::distance_lower_bound
FCL_REAL distance_lower_bound
Definition: collision_data.h:312
hpp::fcl::Contact
Contact information returned by collision.
Definition: collision_data.h:54


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:13