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 |
|
|
|
8 |
|
|
#include "hpp/fcl/collision_data.h" |
9 |
|
|
#include "hpp/fcl/serialization/fwd.h" |
10 |
|
|
|
11 |
|
|
namespace boost { |
12 |
|
|
namespace serialization { |
13 |
|
|
|
14 |
|
|
template <class Archive> |
15 |
|
18 |
void save(Archive& ar, const hpp::fcl::Contact& contact, |
16 |
|
|
const unsigned int /*version*/) { |
17 |
✓✗ |
18 |
ar& make_nvp("b1", contact.b1); |
18 |
✓✗ |
18 |
ar& make_nvp("b2", contact.b2); |
19 |
✓✗ |
18 |
ar& make_nvp("normal", contact.normal); |
20 |
✓✗ |
18 |
ar& make_nvp("pos", contact.pos); |
21 |
✓✗ |
18 |
ar& make_nvp("penetration_depth", contact.penetration_depth); |
22 |
|
18 |
} |
23 |
|
|
|
24 |
|
|
template <class Archive> |
25 |
|
18 |
void load(Archive& ar, hpp::fcl::Contact& contact, |
26 |
|
|
const unsigned int /*version*/) { |
27 |
✓✗ |
18 |
ar >> make_nvp("b1", contact.b1); |
28 |
✓✗ |
18 |
ar >> make_nvp("b2", contact.b2); |
29 |
✓✗ |
18 |
ar >> make_nvp("normal", contact.normal); |
30 |
✓✗ |
18 |
ar >> make_nvp("pos", contact.pos); |
31 |
✓✗ |
18 |
ar >> make_nvp("penetration_depth", contact.penetration_depth); |
32 |
|
18 |
contact.o1 = NULL; |
33 |
|
18 |
contact.o2 = NULL; |
34 |
|
18 |
} |
35 |
|
|
|
36 |
|
36 |
HPP_FCL_SERIALIZATION_SPLIT(hpp::fcl::Contact) |
37 |
|
|
|
38 |
|
|
template <class Archive> |
39 |
|
24 |
void serialize(Archive& ar, hpp::fcl::QueryRequest& query_request, |
40 |
|
|
const unsigned int /*version*/) { |
41 |
✓✗ |
24 |
ar& make_nvp("gjk_initial_guess", query_request.gjk_initial_guess); |
42 |
|
|
// TODO: use gjk_initial_guess instead |
43 |
|
|
HPP_FCL_COMPILER_DIAGNOSTIC_PUSH |
44 |
|
|
HPP_FCL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS |
45 |
✓✗ |
24 |
ar& make_nvp("enable_cached_gjk_guess", |
46 |
|
24 |
query_request.enable_cached_gjk_guess); |
47 |
|
|
HPP_FCL_COMPILER_DIAGNOSTIC_POP |
48 |
✓✗ |
24 |
ar& make_nvp("cached_gjk_guess", query_request.cached_gjk_guess); |
49 |
✓✗ |
24 |
ar& make_nvp("cached_support_func_guess", |
50 |
|
24 |
query_request.cached_support_func_guess); |
51 |
✓✗ |
24 |
ar& make_nvp("enable_timings", query_request.enable_timings); |
52 |
|
24 |
} |
53 |
|
|
|
54 |
|
|
template <class Archive> |
55 |
|
24 |
void serialize(Archive& ar, hpp::fcl::QueryResult& query_result, |
56 |
|
|
const unsigned int /*version*/) { |
57 |
✓✗ |
24 |
ar& make_nvp("cached_gjk_guess", query_result.cached_gjk_guess); |
58 |
✓✗ |
24 |
ar& make_nvp("cached_support_func_guess", |
59 |
|
24 |
query_result.cached_support_func_guess); |
60 |
|
24 |
} |
61 |
|
|
|
62 |
|
|
template <class Archive> |
63 |
|
12 |
void serialize(Archive& ar, hpp::fcl::CollisionRequest& collision_request, |
64 |
|
|
const unsigned int /*version*/) { |
65 |
✓✗ |
12 |
ar& make_nvp("base", |
66 |
|
|
boost::serialization::base_object<hpp::fcl::QueryRequest>( |
67 |
|
12 |
collision_request)); |
68 |
✓✗ |
12 |
ar& make_nvp("num_max_contacts", collision_request.num_max_contacts); |
69 |
✓✗ |
12 |
ar& make_nvp("enable_contact", collision_request.enable_contact); |
70 |
✓✗ |
12 |
ar& make_nvp("enable_distance_lower_bound", |
71 |
|
12 |
collision_request.enable_distance_lower_bound); |
72 |
✓✗ |
12 |
ar& make_nvp("security_margin", collision_request.security_margin); |
73 |
✓✗ |
12 |
ar& make_nvp("break_distance", collision_request.break_distance); |
74 |
|
12 |
} |
75 |
|
|
|
76 |
|
|
template <class Archive> |
77 |
|
6 |
void save(Archive& ar, const hpp::fcl::CollisionResult& collision_result, |
78 |
|
|
const unsigned int /*version*/) { |
79 |
✓✗ |
6 |
ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>( |
80 |
|
6 |
collision_result)); |
81 |
✓✗ |
6 |
ar& make_nvp("contacts", collision_result.getContacts()); |
82 |
✓✗ |
6 |
ar& make_nvp("distance_lower_bound", collision_result.distance_lower_bound); |
83 |
|
6 |
} |
84 |
|
|
|
85 |
|
|
template <class Archive> |
86 |
|
6 |
void load(Archive& ar, hpp::fcl::CollisionResult& collision_result, |
87 |
|
|
const unsigned int /*version*/) { |
88 |
✓✗ |
6 |
ar >> |
89 |
|
|
make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>( |
90 |
✓✗✓✗
|
6 |
collision_result)); |
91 |
|
6 |
std::vector<hpp::fcl::Contact> contacts; |
92 |
✓✗✓✗
|
6 |
ar >> make_nvp("contacts", contacts); |
93 |
|
6 |
collision_result.clear(); |
94 |
✓✓ |
18 |
for (size_t k = 0; k < contacts.size(); ++k) |
95 |
✓✗ |
12 |
collision_result.addContact(contacts[k]); |
96 |
✓✗✓✗
|
6 |
ar >> make_nvp("distance_lower_bound", collision_result.distance_lower_bound); |
97 |
|
6 |
} |
98 |
|
|
|
99 |
|
12 |
HPP_FCL_SERIALIZATION_SPLIT(hpp::fcl::CollisionResult) |
100 |
|
|
|
101 |
|
|
template <class Archive> |
102 |
|
12 |
void serialize(Archive& ar, hpp::fcl::DistanceRequest& distance_request, |
103 |
|
|
const unsigned int /*version*/) { |
104 |
✓✗ |
12 |
ar& make_nvp("base", |
105 |
|
|
boost::serialization::base_object<hpp::fcl::QueryRequest>( |
106 |
|
12 |
distance_request)); |
107 |
✓✗ |
12 |
ar& make_nvp("enable_nearest_points", distance_request.enable_nearest_points); |
108 |
✓✗ |
12 |
ar& make_nvp("rel_err", distance_request.rel_err); |
109 |
✓✗ |
12 |
ar& make_nvp("abs_err", distance_request.abs_err); |
110 |
|
12 |
} |
111 |
|
|
|
112 |
|
|
template <class Archive> |
113 |
|
6 |
void save(Archive& ar, const hpp::fcl::DistanceResult& distance_result, |
114 |
|
|
const unsigned int /*version*/) { |
115 |
✓✗ |
6 |
ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>( |
116 |
|
6 |
distance_result)); |
117 |
✓✗ |
6 |
ar& make_nvp("min_distance", distance_result.min_distance); |
118 |
✓✗✓✗
|
6 |
ar& make_nvp("nearest_points", make_array(distance_result.nearest_points, 2)); |
119 |
✓✗ |
6 |
ar& make_nvp("normal", distance_result.normal); |
120 |
✓✗ |
6 |
ar& make_nvp("b1", distance_result.b1); |
121 |
✓✗ |
6 |
ar& make_nvp("b2", distance_result.b2); |
122 |
|
6 |
} |
123 |
|
|
|
124 |
|
|
template <class Archive> |
125 |
|
6 |
void load(Archive& ar, hpp::fcl::DistanceResult& distance_result, |
126 |
|
|
const unsigned int /*version*/) { |
127 |
✓✗ |
6 |
ar >> |
128 |
|
|
make_nvp("base", boost::serialization::base_object<hpp::fcl::QueryResult>( |
129 |
|
6 |
distance_result)); |
130 |
✓✗ |
6 |
ar >> make_nvp("min_distance", distance_result.min_distance); |
131 |
✓✗✓✗
|
6 |
ar >> |
132 |
|
6 |
make_nvp("nearest_points", make_array(distance_result.nearest_points, 2)); |
133 |
✓✗ |
6 |
ar >> make_nvp("normal", distance_result.normal); |
134 |
✓✗ |
6 |
ar >> make_nvp("b1", distance_result.b1); |
135 |
✓✗ |
6 |
ar >> make_nvp("b2", distance_result.b2); |
136 |
|
6 |
distance_result.o1 = NULL; |
137 |
|
6 |
distance_result.o2 = NULL; |
138 |
|
6 |
} |
139 |
|
|
|
140 |
|
12 |
HPP_FCL_SERIALIZATION_SPLIT(hpp::fcl::DistanceResult) |
141 |
|
|
|
142 |
|
|
} // namespace serialization |
143 |
|
|
} // namespace boost |
144 |
|
|
|
145 |
|
|
#endif // ifndef HPP_FCL_SERIALIZATION_COLLISION_DATA_H |