27 lines
637 B
C++
27 lines
637 B
C++
#include "line.hpp"
|
|
#include "math/transforms.hpp"
|
|
#include "contexts/drawing_context.hpp"
|
|
|
|
void primitives::Line::Translate(const math::Vector& offset)
|
|
{
|
|
m_p0 += offset;
|
|
m_p1 += offset;
|
|
}
|
|
|
|
void primitives::Line::Rotate(const math::Vector& center, float angle)
|
|
{
|
|
m_p0 = math::RotatePoint(center, angle, m_p0);
|
|
m_p1 = math::RotatePoint(center, angle, m_p1);
|
|
}
|
|
|
|
void primitives::Line::Scale(const math::Vector& center, float factor)
|
|
{
|
|
m_p0 = math::ScalePoint(center, factor, m_p0);
|
|
m_p1 = math::ScalePoint(center, factor, m_p1);
|
|
}
|
|
|
|
void primitives::Line::Draw(DrawingContext& ctx)
|
|
{
|
|
ctx.DrawLine(m_p0, m_p1);
|
|
}
|