coal 3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
Loading...
Searching...
No Matches
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
12namespace boost {
13namespace serialization {
14
15template <class Archive>
16void 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::Scalar 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
29template <class Archive>
30void 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
39template <class Archive>
40void 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
45template <class Archive>
46void 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
53template <class Archive>
54void 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
61template <class Archive>
62void 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
70template <class Archive>
71void 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
78template <class Archive>
79void 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
87template <class Archive>
88void 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
96template <class Archive>
97void 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
Center at zero point, axis aligned box.
Definition geometric_shapes.h:164
Vec3s halfSide
box side half-length
Definition geometric_shapes.h:187
Capsule It is where is the distance between the point x and the capsule segment AB,...
Definition geometric_shapes.h:381
Scalar halfLength
Half Length along z axis.
Definition geometric_shapes.h:400
Scalar radius
Radius of capsule.
Definition geometric_shapes.h:397
Cone The base of the cone is at and the top is at .
Definition geometric_shapes.h:466
Scalar halfLength
Half Length along z axis.
Definition geometric_shapes.h:485
Scalar radius
Radius of the cone.
Definition geometric_shapes.h:482
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition geometric_shapes.h:556
Scalar radius
Radius of the cylinder.
Definition geometric_shapes.h:580
Scalar halfLength
Half Length along z axis.
Definition geometric_shapes.h:583
Ellipsoid centered at point zero.
Definition geometric_shapes.h:303
Vec3s radii
Radii of the Ellipsoid (such that on boundary: x^2/rx^2 + y^2/ry^2.
Definition geometric_shapes.h:319
Half Space: this is equivalent to the Plane in ODE. A Half space has a priviledged direction: the dir...
Definition geometric_shapes.h:963
Vec3s n
Plane normal.
Definition geometric_shapes.h:1027
Scalar d
Plane offset.
Definition geometric_shapes.h:1030
Infinite plane. A plane can be viewed as two half spaces; it has no priviledged direction....
Definition geometric_shapes.h:1054
Vec3s n
Plane normal.
Definition geometric_shapes.h:1104
Scalar d
Plane offset.
Definition geometric_shapes.h:1107
Base class for all basic geometric shapes.
Definition geometric_shapes.h:58
void setSweptSphereRadius(Scalar radius)
Set radius of sphere swept around the shape. Must be >= 0.
Definition geometric_shapes.h:76
Scalar getSweptSphereRadius() const
Get radius of sphere swept around the shape. This radius is always >= 0.
Definition geometric_shapes.h:86
Center at zero point sphere.
Definition geometric_shapes.h:238
Scalar radius
Radius of the sphere.
Definition geometric_shapes.h:251
Triangle stores the points instead of only indices of points.
Definition geometric_shapes.h:108
Vec3s a
Definition geometric_shapes.h:147
Vec3s b
Definition geometric_shapes.h:147
Vec3s c
Definition geometric_shapes.h:147
#define COAL_SERIALIZATION_DECLARE_EXPORT(T)
Definition fwd.h:30
void serialize(Archive &ar, coal::AABB &aabb, const unsigned int)
Definition AABB.h:15
Definition AABB.h:11
Main namespace.
Definition broadphase_bruteforce.h:44
double Scalar
Definition data_types.h:68