[apps/calculation] additional_outputs: improve drawRect of

TrigonometryGraphView
This commit is contained in:
Émilie Feral
2020-01-07 16:38:32 +01:00
committed by Léa Saviot
parent 29bab70dcd
commit aed52236d3

View File

@@ -19,10 +19,14 @@ void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const {
drawCurve(ctx, rect, 0, 2.0f*M_PI, M_PI/180.0f, [](float t, void * model, void * context) {
return Poincare::Coordinate2D<float>(std::cos(t), std::sin(t));
}, nullptr, nullptr, true, Palette::GreyDark, false);
// Draw dashed segment to indicate sine and cosine
drawSegment(ctx, rect, Axis::Vertical, std::cos(m_model->angle()), 0.0f, std::sin(m_model->angle()), Palette::Red, 1, 3);
drawSegment(ctx, rect, Axis::Horizontal, std::sin(m_model->angle()), 0.0f, std::cos(m_model->angle()), Palette::Red, 1, 3);
// Draw angle position on the circle
drawDot(ctx, rect, std::cos(m_model->angle()), std::sin(m_model->angle()), Palette::Red);
// TODO
// Draw labels
drawLabel(ctx, rect, Axis::Vertical, std::sin(m_model->angle()), "sin(θ)", Palette::Red);
drawLabel(ctx, rect, Axis::Horizontal, std::cos(m_model->angle()), "cos(θ)", Palette::Red);
}
}