-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
shape_to_string.cc
36 lines (27 loc) · 1.05 KB
/
shape_to_string.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "drake/geometry/shape_to_string.h"
#include <fmt/format.h>
namespace drake {
namespace geometry {
void ShapeToString::ImplementGeometry(const Sphere& sphere, void*) {
string_ = fmt::format("Sphere(r: {})", sphere.get_radius());
}
void ShapeToString::ImplementGeometry(const Cylinder& cylinder, void*) {
string_ = fmt::format("Cylinder(r: {}, l: {})", cylinder.get_radius(),
cylinder.get_length());
}
void ShapeToString::ImplementGeometry(const HalfSpace&, void*) {
string_ = "Halfspace";
}
void ShapeToString::ImplementGeometry(const Box& box, void*) {
string_ = fmt::format("Box(w: {}, d: {}, h: {})", box.width(), box.depth(),
box.height());
}
void ShapeToString::ImplementGeometry(const Mesh& mesh, void*) {
string_ = fmt::format("Mesh(s: {}, path: {})", mesh.scale(), mesh.filename());
}
void ShapeToString::ImplementGeometry(const Convex& convex, void*) {
string_ =
fmt::format("Convex(s: {}, path: {})", convex.scale(), convex.filename());
}
} // namespace geometry
} // namespace drake