28 cairo_surface_t* surface) {
29 if (trajectory.node_size() == 0) {
32 constexpr
double kTrajectoryWidth = 4.;
33 constexpr
double kTrajectoryEndMarkers = 6.;
34 constexpr
double kAlpha = 0.7;
38 cairo_set_source_rgba(cr.get(), color[0], color[1], color[2], kAlpha);
39 cairo_set_line_width(cr.get(), kTrajectoryWidth);
41 for (
const auto& node : trajectory.node()) {
42 const Eigen::Array2i pixel =
44 cairo_line_to(cr.get(), pixel.x(), pixel.y());
46 cairo_stroke(cr.get());
50 const Eigen::Array2i pixel =
52 cairo_set_source_rgba(cr.get(), 0., 1., 0., kAlpha);
53 cairo_arc(cr.get(), pixel.x(), pixel.y(), kTrajectoryEndMarkers, 0,
59 trajectory.node(trajectory.node_size() - 1).
pose()));
60 cairo_set_source_rgba(cr.get(), 1., 0., 0., kAlpha);
61 cairo_arc(cr.get(), pixel.x(), pixel.y(), kTrajectoryEndMarkers, 0,
65 cairo_surface_flush(surface);
std::array< float, 3 > FloatColor
std::function< Eigen::Array2i(const transform::Rigid3d &pose)> PoseToPixelFunction
UniqueCairoPtr MakeUniqueCairoPtr(cairo_t *surface)
void DrawTrajectory(const mapping::proto::Trajectory &trajectory, const FloatColor &color, const PoseToPixelFunction &pose_to_pixel, cairo_surface_t *surface)