coal/serialization/geometric_shapes.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021-2024 INRIA
3 //
4 
5 #ifndef COAL_SERIALIZATION_GEOMETRIC_SHAPES_H
6 #define COAL_SERIALIZATION_GEOMETRIC_SHAPES_H
7 
11 
12 namespace boost {
13 namespace serialization {
14 
15 template <class Archive>
16 void serialize(Archive& ar, coal::ShapeBase& shape_base,
17  const unsigned int /*version*/) {
18  ar& make_nvp(
19  "base",
20  boost::serialization::base_object<coal::CollisionGeometry>(shape_base));
21  ::coal::CoalScalar 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, coal::TriangleP& triangle,
31  const unsigned int /*version*/) {
32  ar& make_nvp("base",
33  boost::serialization::base_object<coal::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, coal::Box& box, const unsigned int /*version*/) {
41  ar& make_nvp("base", boost::serialization::base_object<coal::ShapeBase>(box));
42  ar& make_nvp("halfSide", box.halfSide);
43 }
44 
45 template <class Archive>
46 void serialize(Archive& ar, coal::Sphere& sphere,
47  const unsigned int /*version*/) {
48  ar& make_nvp("base",
49  boost::serialization::base_object<coal::ShapeBase>(sphere));
50  ar& make_nvp("radius", sphere.radius);
51 }
52 
53 template <class Archive>
54 void serialize(Archive& ar, coal::Ellipsoid& ellipsoid,
55  const unsigned int /*version*/) {
56  ar& make_nvp("base",
57  boost::serialization::base_object<coal::ShapeBase>(ellipsoid));
58  ar& make_nvp("radii", ellipsoid.radii);
59 }
60 
61 template <class Archive>
62 void serialize(Archive& ar, coal::Capsule& capsule,
63  const unsigned int /*version*/) {
64  ar& make_nvp("base",
65  boost::serialization::base_object<coal::ShapeBase>(capsule));
66  ar& make_nvp("radius", capsule.radius);
67  ar& make_nvp("halfLength", capsule.halfLength);
68 }
69 
70 template <class Archive>
71 void serialize(Archive& ar, coal::Cone& cone, const unsigned int /*version*/) {
72  ar& make_nvp("base",
73  boost::serialization::base_object<coal::ShapeBase>(cone));
74  ar& make_nvp("radius", cone.radius);
75  ar& make_nvp("halfLength", cone.halfLength);
76 }
77 
78 template <class Archive>
79 void serialize(Archive& ar, coal::Cylinder& cylinder,
80  const unsigned int /*version*/) {
81  ar& make_nvp("base",
82  boost::serialization::base_object<coal::ShapeBase>(cylinder));
83  ar& make_nvp("radius", cylinder.radius);
84  ar& make_nvp("halfLength", cylinder.halfLength);
85 }
86 
87 template <class Archive>
88 void serialize(Archive& ar, coal::Halfspace& half_space,
89  const unsigned int /*version*/) {
90  ar& make_nvp("base",
91  boost::serialization::base_object<coal::ShapeBase>(half_space));
92  ar& make_nvp("n", half_space.n);
93  ar& make_nvp("d", half_space.d);
94 }
95 
96 template <class Archive>
97 void serialize(Archive& ar, coal::Plane& plane,
98  const unsigned int /*version*/) {
99  ar& make_nvp("base",
100  boost::serialization::base_object<coal::ShapeBase>(plane));
101  ar& make_nvp("n", plane.n);
102  ar& make_nvp("d", plane.d);
103 }
104 
105 } // namespace serialization
106 } // namespace boost
107 
119 
120 #endif // ifndef COAL_SERIALIZATION_GEOMETRIC_SHAPES_H
fwd.h
coal::TriangleP::b
Vec3s b
Definition: coal/shape/geometric_shapes.h:149
coal::Cylinder::halfLength
CoalScalar halfLength
Half Length along z axis.
Definition: coal/shape/geometric_shapes.h:587
collision_manager.box
box
Definition: collision_manager.py:11
boost::serialization::serialize
void serialize(Archive &ar, coal::AABB &aabb, const unsigned int)
Definition: coal/serialization/AABB.h:15
coal::Capsule::halfLength
CoalScalar halfLength
Half Length along z axis.
Definition: coal/shape/geometric_shapes.h:402
collision_manager.sphere
sphere
Definition: collision_manager.py:4
coal::Halfspace
Half Space: this is equivalent to the Plane in ODE. A Half space has a priviledged direction: the dir...
Definition: coal/shape/geometric_shapes.h:892
coal::Capsule
Capsule It is where is the distance between the point x and the capsule segment AB,...
Definition: coal/shape/geometric_shapes.h:383
coal::Cylinder::radius
CoalScalar radius
Radius of the cylinder.
Definition: coal/shape/geometric_shapes.h:581
boost
coal::Ellipsoid
Ellipsoid centered at point zero.
Definition: coal/shape/geometric_shapes.h:305
COAL_SERIALIZATION_DECLARE_EXPORT
#define COAL_SERIALIZATION_DECLARE_EXPORT(T)
Definition: coal/serialization/fwd.h:30
coal::CollisionGeometry
The geometry for the object for collision or distance computation.
Definition: coal/collision_object.h:94
coal::Ellipsoid::radii
Vec3s radii
Radii of the Ellipsoid (such that on boundary: x^2/rx^2 + y^2/ry^2.
Definition: coal/shape/geometric_shapes.h:318
coal::Plane
Infinite plane. A plane can be viewed as two half spaces; it has no priviledged direction....
Definition: coal/shape/geometric_shapes.h:983
coal::Box
Center at zero point, axis aligned box.
Definition: coal/shape/geometric_shapes.h:166
coal::Sphere
Center at zero point sphere.
Definition: coal/shape/geometric_shapes.h:240
coal::TriangleP::a
Vec3s a
Definition: coal/shape/geometric_shapes.h:149
coal::Cone::halfLength
CoalScalar halfLength
Half Length along z axis.
Definition: coal/shape/geometric_shapes.h:486
coal::ShapeBase
Base class for all basic geometric shapes.
Definition: coal/shape/geometric_shapes.h:58
coal::Cylinder
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition: coal/shape/geometric_shapes.h:560
collision_object.h
coal::TriangleP
Triangle stores the points instead of only indices of points.
Definition: coal/shape/geometric_shapes.h:110
coal::ShapeBase::getSweptSphereRadius
CoalScalar getSweptSphereRadius() const
Get radius of sphere swept around the shape. This radius is always >= 0.
Definition: coal/shape/geometric_shapes.h:86
coal::Cone
Cone The base of the cone is at and the top is at .
Definition: coal/shape/geometric_shapes.h:467
coal::Halfspace::n
Vec3s n
Plane normal.
Definition: coal/shape/geometric_shapes.h:956
coal::Cone::radius
CoalScalar radius
Radius of the cone.
Definition: coal/shape/geometric_shapes.h:480
coal::Halfspace::d
CoalScalar d
Plane offset.
Definition: coal/shape/geometric_shapes.h:959
coal::Plane::n
Vec3s n
Plane normal.
Definition: coal/shape/geometric_shapes.h:1034
coal::ShapeBase::setSweptSphereRadius
void setSweptSphereRadius(CoalScalar radius)
Set radius of sphere swept around the shape. Must be >= 0.
Definition: coal/shape/geometric_shapes.h:76
coal::Capsule::radius
CoalScalar radius
Radius of capsule.
Definition: coal/shape/geometric_shapes.h:396
geometric_shapes.h
coal::TriangleP::c
Vec3s c
Definition: coal/shape/geometric_shapes.h:149
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::Plane::d
CoalScalar d
Plane offset.
Definition: coal/shape/geometric_shapes.h:1037


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