From bb8bf9862c65f24f4b77603ecb520580bbb2e105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 14 Oct 2019 13:26:51 +0200 Subject: [PATCH] [apps/calculation] ComplexGraphView: add the angle value on the graph --- .../additional_outputs/complex_graph_view.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/calculation/additional_outputs/complex_graph_view.cpp b/apps/calculation/additional_outputs/complex_graph_view.cpp index 69337f7a7..68415fec9 100644 --- a/apps/calculation/additional_outputs/complex_graph_view.cpp +++ b/apps/calculation/additional_outputs/complex_graph_view.cpp @@ -1,6 +1,7 @@ #include "complex_graph_view.h" using namespace Shared; +using namespace Poincare; namespace Calculation { @@ -38,6 +39,15 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const { drawLabel(ctx, rect, Axis::Vertical, imag); drawAxisLabel(ctx, rect, Axis::Horizontal, "Re", real > 0.0f); drawAxisLabel(ctx, rect, Axis::Vertical, "Im", imag > 0.0f); + char buffer[k_labelBufferMaxSize]; + PrintFloat::ConvertFloatToText( + std::arg(*m_complex), + buffer, + k_labelBufferMaxSize, + k_labelBufferMaxGlyphLength, + Poincare::Preferences::ShortNumberOfSignificantDigits, + Preferences::PrintFloatMode::Decimal); + ctx->drawString(buffer, KDPoint(floatToPixel(Axis::Horizontal, std::fabs(real)/2.0f)+KDFont::SmallFont->glyphSize().width(), floatToPixel(Axis::Vertical, 0.0f)-KDFont::SmallFont->glyphSize().height()), KDFont::SmallFont); } }