Program Listing for File polygon2D_visualizer.hpp

Return to documentation for file (cosm/argos/vis/polygon2D_visualizer.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <vector>

#include <argos3/core/utility/math/quaternion.h>

#include "rcppsw/math/vector2.hpp"
#include "rcppsw/math/vector3.hpp"
#include "rcppsw/utils/color.hpp"

#include "cosm/cosm.hpp"

/*******************************************************************************
 * Namespaces
 ******************************************************************************/
namespace argos {
class CQTOpenGLUserFunctions;
}

namespace cosm::argos::vis {

/*******************************************************************************
 * Classes
 ******************************************************************************/
class polygon2D_visualizer {
 public:
  explicit polygon2D_visualizer(::argos::CQTOpenGLUserFunctions* qt) : m_qt(qt) {}

  /* not copy constructible/assignable by default */
  polygon2D_visualizer(const polygon2D_visualizer&) = delete;
  polygon2D_visualizer& operator=(const polygon2D_visualizer&) = delete;

  void relative_draw(const rmath::vector3d& pos,
                     const std::vector<rmath::vector2d>& points,
                     const rutils::color& color);

  void abs_draw(const rmath::vector3d& pos,
                const ::argos::CQuaternion& orientation,
                const std::vector<rmath::vector2d>& points,
                const rutils::color& color);

 private:
  /* draw a little off the ground so it renders better */
  static constexpr const double kDRAW_OFFSET = 0.05;

  /* clang-format off */
  ::argos::CQTOpenGLUserFunctions* const m_qt{nullptr};
  /* clang-format on */
};

} /* namespace cosm::argos::vis */