hpp-fcl  3.0.0
HPP fork of FCL -- The Flexible Collision Library
geometric_shapes.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021-2024 INRIA
3 //
4 
5 #ifndef HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H
6 #define HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H
7 
11 
12 namespace boost {
13 namespace serialization {
14 
15 template <class Archive>
16 void serialize(Archive& ar, hpp::fcl::ShapeBase& shape_base,
17  const unsigned int /*version*/) {
18  ar& make_nvp("base",
19  boost::serialization::base_object<hpp::fcl::CollisionGeometry>(
20  shape_base));
21  ::hpp::fcl::FCL_REAL radius = shape_base.getSweptSphereRadius();
22  ar& make_nvp("swept_sphere_radius", radius);
23 
24  if (Archive::is_loading::value) {
25  shape_base.setSweptSphereRadius(radius);
26  }
27 }
28 
29 template <class Archive>
30 void serialize(Archive& ar, hpp::fcl::TriangleP& triangle,
31  const unsigned int /*version*/) {
32  ar& make_nvp(
33  "base", boost::serialization::base_object<hpp::fcl::ShapeBase>(triangle));
34  ar& make_nvp("a", triangle.a);
35  ar& make_nvp("b", triangle.b);
36  ar& make_nvp("c", triangle.c);
37 }
38 
39 template <class Archive>
40 void serialize(Archive& ar, hpp::fcl::Box& box,
41  const unsigned int /*version*/) {
42  ar& make_nvp("base",
43  boost::serialization::base_object<hpp::fcl::ShapeBase>(box));
44  ar& make_nvp("halfSide", box.halfSide);
45 }
46 
47 template <class Archive>
48 void serialize(Archive& ar, hpp::fcl::Sphere& sphere,
49  const unsigned int /*version*/) {
50  ar& make_nvp("base",
51  boost::serialization::base_object<hpp::fcl::ShapeBase>(sphere));
52  ar& make_nvp("radius", sphere.radius);
53 }
54 
55 template <class Archive>
56 void serialize(Archive& ar, hpp::fcl::Ellipsoid& ellipsoid,
57  const unsigned int /*version*/) {
58  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::ShapeBase>(
59  ellipsoid));
60  ar& make_nvp("radii", ellipsoid.radii);
61 }
62 
63 template <class Archive>
64 void serialize(Archive& ar, hpp::fcl::Capsule& capsule,
65  const unsigned int /*version*/) {
66  ar& make_nvp("base",
67  boost::serialization::base_object<hpp::fcl::ShapeBase>(capsule));
68  ar& make_nvp("radius", capsule.radius);
69  ar& make_nvp("halfLength", capsule.halfLength);
70 }
71 
72 template <class Archive>
73 void serialize(Archive& ar, hpp::fcl::Cone& cone,
74  const unsigned int /*version*/) {
75  ar& make_nvp("base",
76  boost::serialization::base_object<hpp::fcl::ShapeBase>(cone));
77  ar& make_nvp("radius", cone.radius);
78  ar& make_nvp("halfLength", cone.halfLength);
79 }
80 
81 template <class Archive>
82 void serialize(Archive& ar, hpp::fcl::Cylinder& cylinder,
83  const unsigned int /*version*/) {
84  ar& make_nvp(
85  "base", boost::serialization::base_object<hpp::fcl::ShapeBase>(cylinder));
86  ar& make_nvp("radius", cylinder.radius);
87  ar& make_nvp("halfLength", cylinder.halfLength);
88 }
89 
90 template <class Archive>
91 void serialize(Archive& ar, hpp::fcl::Halfspace& half_space,
92  const unsigned int /*version*/) {
93  ar& make_nvp("base", boost::serialization::base_object<hpp::fcl::ShapeBase>(
94  half_space));
95  ar& make_nvp("n", half_space.n);
96  ar& make_nvp("d", half_space.d);
97 }
98 
99 template <class Archive>
100 void serialize(Archive& ar, hpp::fcl::Plane& plane,
101  const unsigned int /*version*/) {
102  ar& make_nvp("base",
103  boost::serialization::base_object<hpp::fcl::ShapeBase>(plane));
104  ar& make_nvp("n", plane.n);
105  ar& make_nvp("d", plane.d);
106 }
107 
108 } // namespace serialization
109 } // namespace boost
110 
112 HPP_FCL_SERIALIZATION_DECLARE_EXPORT(::hpp::fcl::CollisionGeometry)
122 
123 #endif // ifndef HPP_FCL_SERIALIZATION_GEOMETRIC_SHAPES_H
Center at zero point, axis aligned box.
Definition: geometric_shapes.h:164
Capsule It is where is the distance between the point x and the capsule segment AB,...
Definition: geometric_shapes.h:381
Cone The base of the cone is at and the top is at .
Definition: geometric_shapes.h:465
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition: geometric_shapes.h:555
Ellipsoid centered at point zero.
Definition: geometric_shapes.h:303
Half Space: this is equivalent to the Plane in ODE. A Half space has a priviledged direction: the dir...
Definition: geometric_shapes.h:885
Infinite plane. A plane can be viewed as two half spaces; it has no priviledged direction....
Definition: geometric_shapes.h:976
Base class for all basic geometric shapes.
Definition: geometric_shapes.h:59
Center at zero point sphere.
Definition: geometric_shapes.h:238
Triangle stores the points instead of only indices of points.
Definition: geometric_shapes.h:109
#define HPP_FCL_SERIALIZATION_DECLARE_EXPORT(T)
Definition: fwd.h:30
Vec3f c
Definition: geometric_shapes.h:147
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:400
FCL_REAL getSweptSphereRadius() const
Get radius of sphere swept around the shape. This radius is always >= 0.
Definition: geometric_shapes.h:87
Vec3f a
Definition: geometric_shapes.h:147
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:582
Vec3f n
Plane normal.
Definition: geometric_shapes.h:1027
FCL_REAL radius
Radius of capsule.
Definition: geometric_shapes.h:394
Vec3f n
Plane normal.
Definition: geometric_shapes.h:949
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:484
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:1030
FCL_REAL radius
Radius of the sphere.
Definition: geometric_shapes.h:248
Vec3f halfSide
box side half-length
Definition: geometric_shapes.h:187
FCL_REAL radius
Radius of the cone.
Definition: geometric_shapes.h:478
FCL_REAL radius
Radius of the cylinder.
Definition: geometric_shapes.h:576
void setSweptSphereRadius(FCL_REAL radius)
Set radius of sphere swept around the shape. Must be >= 0.
Definition: geometric_shapes.h:77
Vec3f b
Definition: geometric_shapes.h:147
Vec3f radii
Radii of the Ellipsoid (such that on boundary: x^2/rx^2 + y^2/ry^2.
Definition: geometric_shapes.h:316
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:952
void serialize(Archive &ar, hpp::fcl::AABB &aabb, const unsigned int)
Definition: AABB.h:15
Definition: AABB.h:11
double FCL_REAL
Definition: data_types.h:66
Main namespace.
Definition: broadphase_bruteforce.h:44