coal/serialization/kIOS.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #ifndef COAL_SERIALIZATION_kIOS_H
6 #define COAL_SERIALIZATION_kIOS_H
7 
8 #include "coal/BV/kIOS.h"
9 
10 #include "coal/serialization/OBB.h"
11 #include "coal/serialization/fwd.h"
12 
13 namespace boost {
14 namespace serialization {
15 
16 template <class Archive>
17 void serialize(Archive& ar, coal::kIOS& bv, const unsigned int version) {
18  split_free(ar, bv, version);
19 }
20 
21 template <class Archive>
22 void save(Archive& ar, const coal::kIOS& bv, const unsigned int /*version*/) {
23  // Number of spheres in kIOS is never larger than kIOS::kios_max_num_spheres
24  ar& make_nvp("num_spheres", bv.num_spheres);
25 
26  std::array<coal::Vec3s, coal::kIOS::max_num_spheres> centers{};
27  std::array<coal::CoalScalar, coal::kIOS::max_num_spheres> radii;
28  for (std::size_t i = 0; i < coal::kIOS::max_num_spheres; ++i) {
29  centers[i] = bv.spheres[i].o;
30  radii[i] = bv.spheres[i].r;
31  }
32  ar& make_nvp("centers", make_array(centers.data(), centers.size()));
33  ar& make_nvp("radii", make_array(radii.data(), radii.size()));
34 
35  ar& make_nvp("obb", bv.obb);
36 }
37 
38 template <class Archive>
39 void load(Archive& ar, coal::kIOS& bv, const unsigned int /*version*/) {
40  ar >> make_nvp("num_spheres", bv.num_spheres);
41 
42  std::array<coal::Vec3s, coal::kIOS::max_num_spheres> centers;
43  std::array<coal::CoalScalar, coal::kIOS::max_num_spheres> radii;
44  ar >> make_nvp("centers", make_array(centers.data(), centers.size()));
45  ar >> make_nvp("radii", make_array(radii.data(), radii.size()));
46  for (std::size_t i = 0; i < coal::kIOS::max_num_spheres; ++i) {
47  bv.spheres[i].o = centers[i];
48  bv.spheres[i].r = radii[i];
49  }
50 
51  ar >> make_nvp("obb", bv.obb);
52 }
53 
54 } // namespace serialization
55 } // namespace boost
56 
57 #endif // COAL_SERIALIZATION_kIOS_H
fwd.h
boost::serialization::load
void load(Archive &ar, coal::BVSplitter< BV > &splitter_, const unsigned int)
Definition: coal/serialization/BV_splitter.h:44
coal::kIOS::kIOS_Sphere::o
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Vec3s o
Definition: coal/BV/kIOS.h:57
boost::serialization::serialize
void serialize(Archive &ar, coal::AABB &aabb, const unsigned int)
Definition: coal/serialization/AABB.h:15
coal::kIOS::kIOS_Sphere::r
CoalScalar r
Definition: coal/BV/kIOS.h:58
boost
coal::kIOS
A class describing the kIOS collision structure, which is a set of spheres.
Definition: coal/BV/kIOS.h:52
coal::kIOS::spheres
kIOS_Sphere spheres[max_num_spheres]
The (at most) five spheres for intersection.
Definition: coal/BV/kIOS.h:116
version
version
coal::kIOS::num_spheres
unsigned int num_spheres
The number of spheres, no larger than 5.
Definition: coal/BV/kIOS.h:119
kIOS.h
OBB.h
coal::kIOS::obb
OBB obb
@ OBB related with kIOS
Definition: coal/BV/kIOS.h:122
coal::kIOS::max_num_spheres
static constexpr size_t max_num_spheres
Definition: coal/BV/kIOS.h:113
boost::serialization::save
void save(Archive &ar, const coal::BVSplitter< BV > &splitter_, const unsigned int)
Definition: coal/serialization/BV_splitter.h:30


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58