5 #ifndef HPP_FCL_SERIALIZATION_BVH_MODEL_H
6 #define HPP_FCL_SERIALIZATION_BVH_MODEL_H
18 namespace serialization {
28 template <
class Archive>
30 const unsigned int ) {
36 "The BVH model is not in a BVH_BUILD_STATE_PROCESSED or "
37 "BVH_BUILD_STATE_UPDATED state.\n"
38 "The BVHModel could not be serialized.",
39 std::invalid_argument);
43 boost::serialization::base_object<hpp::fcl::CollisionGeometry>(
47 ar &make_nvp(
"vertices", bvh_model.
vertices);
49 ar &make_nvp(
"num_tris", bvh_model.
num_tris);
67 template <
class Archive>
69 const unsigned int ) {
72 ar >> make_nvp(
"base",
73 boost::serialization::base_object<hpp::fcl::CollisionGeometry>(
77 ar >> make_nvp(
"vertices", bvh_model.
vertices);
79 ar >> make_nvp(
"num_tris", bvh_model.
num_tris);
80 ar >> make_nvp(
"tri_indices", bvh_model.
tri_indices);
81 ar >> make_nvp(
"build_state", bvh_model.
build_state);
92 template <
typename BV>
102 template <
class Archive,
typename BV>
104 const unsigned int version) {
105 split_free(ar, bvh_model, version);
108 template <
class Archive,
typename BV>
110 const unsigned int ) {
115 const Accessor &bvh_model =
reinterpret_cast<const Accessor &
>(bvh_model_);
117 boost::serialization::base_object<BVHModelBase>(bvh_model));
157 if (bvh_model.bvs.get()) {
158 const bool with_bvs =
true;
159 ar &make_nvp(
"with_bvs", with_bvs);
160 ar &make_nvp(
"num_bvs", bvh_model.num_bvs);
164 reinterpret_cast<const char *
>(bvh_model.bvs->data()),
166 (std::size_t)bvh_model.num_bvs));
168 const bool with_bvs =
false;
169 ar &make_nvp(
"with_bvs", with_bvs);
173 template <
class Archive,
typename BV>
175 const unsigned int ) {
180 Accessor &bvh_model =
reinterpret_cast<Accessor &
>(bvh_model_);
182 ar >> make_nvp(
"base",
183 boost::serialization::base_object<BVHModelBase>(bvh_model));
204 ar >> make_nvp(
"with_bvs", with_bvs);
206 unsigned int num_bvs;
207 ar >> make_nvp(
"num_bvs", num_bvs);
209 if (num_bvs != bvh_model.num_bvs) {
210 bvh_model.bvs.reset();
211 bvh_model.num_bvs = num_bvs;
213 bvh_model.bvs.reset(
new
217 ar >> make_nvp(
"bvs",
218 make_array(
reinterpret_cast<char *
>(bvh_model.bvs->data()),
219 sizeof(Node) * (std::size_t)num_bvs));
221 bvh_model.bvs.reset();
232 template <
typename BV>
234 static size_t run(const ::hpp::fcl::BVHModel<BV> &bvh_model) {
235 return static_cast<size_t>(bvh_model.memUsage(
false));
A base class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewe...
Definition: BVH_model.h:66
unsigned int num_tris
Number of triangles.
Definition: BVH_model.h:78
std::shared_ptr< std::vector< Vec3f > > prev_vertices
Geometry point data in previous frame.
Definition: BVH_model.h:75
unsigned int num_vertices_allocated
Definition: BVH_model.h:303
std::shared_ptr< std::vector< Vec3f > > vertices
Geometry point data.
Definition: BVH_model.h:69
BVHBuildState build_state
The state of BVH building process.
Definition: BVH_model.h:84
BVHModelType getModelType() const
Model type described by the instance.
Definition: BVH_model.h:90
unsigned int num_vertices
Number of points.
Definition: BVH_model.h:81
unsigned int num_tris_allocated
Definition: BVH_model.h:302
std::shared_ptr< std::vector< Triangle > > tri_indices
Geometry triangle index data, will be NULL for point clouds.
Definition: BVH_model.h:72
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: BVH_model.h:315
std::vector< BVNode< BV >, Eigen::aligned_allocator< BVNode< BV > >> bv_node_vector_t
Definition: BVH_model.h:320
std::shared_ptr< bv_node_vector_t > bvs
Bounding volume hierarchy.
Definition: BVH_model.h:384
unsigned int num_bvs_allocated
Definition: BVH_model.h:380
std::shared_ptr< std::vector< unsigned int > > primitive_indices
Definition: BVH_model.h:381
unsigned int num_bvs
Number of BV nodes in bounding volume hierarchy.
Definition: BVH_model.h:387
KDOP class describes the KDOP collision structures. K is set as the template parameter,...
Definition: kDOP.h:92
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:53
#define HPP_FCL_SERIALIZATION_DECLARE_EXPORT(T)
Definition: fwd.h:30
#define HPP_FCL_SERIALIZATION_SPLIT(Type)
Definition: fwd.h:24
#define HPP_FCL_THROW_PRETTY(message, exception)
Definition: fwd.hh:64
void save(Archive &ar, const hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
Definition: BV_splitter.h:30
void load(Archive &ar, hpp::fcl::BVSplitter< BV > &splitter_, const unsigned int)
Definition: BV_splitter.h:44
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
Definition: AABB.h:15
Definition: broadphase_bruteforce.h:45
@ BVH_BUILD_STATE_PROCESSED
Definition: BVH_internal.h:54
@ BVH_BUILD_STATE_UPDATED
Definition: BVH_internal.h:57
@ BVH_MODEL_TRIANGLES
unknown model type
Definition: BVH_internal.h:82
Main namespace.
Definition: broadphase_bruteforce.h:44
Definition: BVH_model.h:93
hpp::fcl::BVHModel< BV > Base
Definition: BVH_model.h:94
Definition: BVH_model.h:21
hpp::fcl::BVHModelBase Base
Definition: BVH_model.h:22
A class describing a bounding volume node. It includes the tree structure providing in BVNodeBase and...
Definition: BV_node.h:107
Oriented bounding box class.
Definition: OBB.h:52