#ifndef ORIGINCAR_BIRDSEYE__BIRDSEYE_GEOMETRY_HPP_
#define ORIGINCAR_BIRDSEYE__BIRDSEYE_GEOMETRY_HPP_

#include <optional>

#include "origincar_birdseye/ground_projection.hpp"

namespace origincar_birdseye
{

struct BirdseyeCanvas
{
  int width;
  int height;
  double meters_per_pixel;
  double rear_meters;
  double left_meters;
};

class BirdseyeGeometry
{
public:
  explicit BirdseyeGeometry(BirdseyeCanvas canvas)
  : canvas_(canvas)
  {
  }

  std::optional<PixelPoint> basePointToCanvasPixel(const GroundPoint & point) const
  {
    const PixelPoint pixel{
      (canvas_.left_meters - point.y) / canvas_.meters_per_pixel,
      (canvas_.rear_meters - point.x) / canvas_.meters_per_pixel};
    return pixel;
  }

private:
  BirdseyeCanvas canvas_;
};

}  // namespace origincar_birdseye

#endif  // ORIGINCAR_BIRDSEYE__BIRDSEYE_GEOMETRY_HPP_
