cpp_drawing/shapes/line.hpp

30 lines
606 B
C++

#pragma once
#include "math/vector.hpp"
#include "shape.hpp"
namespace shapes
{
/**
* @brief Line shape
*
* Represents a line defined by two points.
*/
class Line final : public Shape
{
public:
Line(const math::Vector& p0, const math::Vector& p1) : m_p0(p0), m_p1(p1) {}
void Translate(const math::Vector& offset) override;
void Rotate(const math::Vector& center, float angle) override;
void Scale(const math::Vector& center, float factor) override;
void Draw(Renderer& renderer) const override;
private:
math::Vector m_p0;
math::Vector m_p1;
};
} // namespace shapes