#pragma once #include #include #include #include class Shape { public: static constexpr int MAX_POINTS{4}; enum class ShapeType { Square, Triangle }; /// \brief Default constructor Shape() = delete; Shape(Shape::ShapeType const t_type); /// \brief Copy constructor Shape(const Shape &other) = default; /// \brief Move constructor Shape(Shape &&other) noexcept; /// \brief Destructor virtual ~Shape() noexcept = default; /// \brief Copy assignment operator Shape &operator=(const Shape &other) = delete; /// \brief Move assignment operator Shape &operator=(Shape &&other) noexcept = delete; /// \brief Generates a shape's points void update(cv::Point &&t_max_pos, int const t_max_size, int const t_min_size = 1) noexcept; [[nodiscard]] auto get_points() const noexcept -> std::array const & { return points_; } /// \brief Returns the type of shape described by the object [[nodiscard]] auto get_type() const noexcept -> ShapeType const & { return type_; } [[nodiscard]] auto get_nb_points() const noexcept { return nb_points_; } protected: private: void create_square_points(cv::Point const &t_top_left, int const t_size) noexcept; void create_triangle_points(cv::Point const &t_top_left, int const t_size) noexcept; ShapeType const type_{ShapeType::Square}; std::array points_{ cv::Point{0, 0}, cv::Point{0, 0}, cv::Point{0, 0}, cv::Point{0, 0}}; int nb_points_{Shape::MAX_POINTS}; };