hpp-fcl  1.8.1
HPP fork of FCL -- The Flexible Collision Library
hfield.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
5 #ifndef HPP_FCL_SERIALIZATION_HFIELD_H
6 #define HPP_FCL_SERIALIZATION_HFIELD_H
7 
8 #include "hpp/fcl/hfield.h"
9 
12 
13 namespace boost
14 {
15  namespace serialization
16  {
17 
18  template <class Archive>
19  void serialize(Archive & ar,
20  hpp::fcl::HFNodeBase & node,
21  const unsigned int /*version*/)
22  {
23  ar & make_nvp("first_child",node.first_child);
24  ar & make_nvp("x_id",node.x_id);
25  ar & make_nvp("x_size",node.x_size);
26  ar & make_nvp("y_id",node.y_id);
27  ar & make_nvp("y_size",node.y_size);
28  }
29 
30  template <class Archive, typename BV>
31  void serialize(Archive & ar,
32  hpp::fcl::HFNode<BV> & node,
33  const unsigned int /*version*/)
34  {
35  ar & make_nvp("base",boost::serialization::base_object<hpp::fcl::HFNodeBase>(node));
36  ar & make_nvp("bv",node.bv);
37  }
38 
39  namespace internal
40  {
41  template<typename BV>
43  {
45  using Base::bvs;
46  using Base::num_bvs;
47  using Base::x_dim;
48  using Base::y_dim;
49  using Base::x_grid;
50  using Base::y_grid;
51  using Base::heights;
52  using Base::min_height;
53  using Base::max_height;
54  };
55  }
56 
57  template <class Archive, typename BV>
58  void serialize(Archive & ar,
59  hpp::fcl::HeightField<BV> & hf_model,
60  const unsigned int /*version*/)
61  {
62  ar & make_nvp("base",boost::serialization::base_object<hpp::fcl::CollisionGeometry>(hf_model));
63 
64 
65  typedef internal::HeightFieldAccessor<BV> Accessor;
66  Accessor & access = reinterpret_cast<Accessor &>(hf_model);
67 
68  ar & make_nvp("x_dim",access.x_dim);
69  ar & make_nvp("y_dim",access.y_dim);
70  ar & make_nvp("heights",access.heights);
71  ar & make_nvp("min_height",access.min_height);
72  ar & make_nvp("max_height",access.max_height);
73  ar & make_nvp("x_grid",access.x_grid);
74  ar & make_nvp("y_grid",access.y_grid);
75 
76  ar & make_nvp("bvs",access.bvs);
77  ar & make_nvp("num_bvs",access.num_bvs);
78  }
79  }
80 }
81 
82 #endif // ifndef HPP_FCL_SERIALIZATION_HFIELD_H
Definition: AABB.h:11
FCL_REAL min_height
Minimal height of the Height Field: all values bellow min_height will be discarded.
Definition: hfield.h:384
Definition: hfield.h:56
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
Definition: AABB.h:17
FCL_REAL y_dim
Definition: hfield.h:378
BV bv
bounding volume storing the geometry
Definition: hfield.h:111
Definition: hfield.h:105
Data structure depicting a height field given by the base grid dimensions and the elevation along the...
Definition: hfield.h:194
BVS bvs
Bounding volume hierarchy.
Definition: hfield.h:390
Eigen::DenseIndex x_size
Definition: hfield.h:64
VecXf y_grid
Definition: hfield.h:387
size_t first_child
An index for first child node or primitive If the value is positive, it is the index of the first chi...
Definition: hfield.h:62
Eigen::DenseIndex y_size
Definition: hfield.h:65
VecXf x_grid
Grids along the X and Y directions. Useful for plotting or other related things.
Definition: hfield.h:387
Eigen::DenseIndex y_id
Definition: hfield.h:65
MatrixXf heights
Elevation values in meters of the Height Field.
Definition: hfield.h:381
FCL_REAL x_dim
Dimensions in meters along X and Y directions.
Definition: hfield.h:378
FCL_REAL max_height
Definition: hfield.h:384
hpp::fcl::HeightField< BV > Base
Definition: hfield.h:44
unsigned int num_bvs
Definition: hfield.h:391
Eigen::DenseIndex x_id
Definition: hfield.h:64