5 #ifndef HPP_FCL_SERIALIZATION_CONVEX_H
6 #define HPP_FCL_SERIALIZATION_CONVEX_H
17 namespace serialization {
27 template <
class Archive>
29 const unsigned int ) {
33 Accessor &accessor =
reinterpret_cast<Accessor &
>(convex_base);
35 ar &make_nvp(
"base", boost::serialization::base_object<hpp::fcl::ShapeBase>(
37 const unsigned int num_points_previous = convex_base.
num_points;
38 ar &make_nvp(
"num_points", convex_base.
num_points);
40 if (Archive::is_loading::value) {
41 if (num_points_previous != convex_base.
num_points ||
42 !accessor.own_storage_) {
43 delete[] convex_base.
points;
45 accessor.own_storage_ =
true;
50 typedef Eigen::Matrix<FCL_REAL, 3, Eigen::Dynamic> MatrixPoints;
51 Eigen::Map<MatrixPoints> points_map(
52 reinterpret_cast<double *
>(convex_base.
points), 3,
54 ar &make_nvp(
"points", points_map);
57 ar &make_nvp(
"center", convex_base.
center);
63 template <
typename PolygonT>
71 template <
class Archive,
typename PolygonT>
73 const unsigned int ) {
77 Accessor &convex =
reinterpret_cast<Accessor &
>(convex_);
78 ar &make_nvp(
"base", boost::serialization::base_object<ConvexBase>(convex));
80 const unsigned int num_polygons_previous = convex.num_polygons;
81 ar &make_nvp(
"num_polygons", convex.num_polygons);
83 if (Archive::is_loading::value) {
84 if (num_polygons_previous != convex.num_polygons) {
85 delete[] convex.polygons;
86 convex.polygons =
new PolygonT[convex.num_polygons];
90 ar &make_array<PolygonT>(convex.polygons, convex.num_polygons);
92 if (Archive::is_loading::value) convex.fillNeighbors();
113 #endif // ifndef HPP_FCL_SERIALIZATION_CONVEX_H