[apps/calculation] WIP: display the complex graph when clicking on the

burger menu
This commit is contained in:
Émilie Feral
2019-10-16 10:16:10 +02:00
committed by Léa Saviot
parent b566846c49
commit f0ec2136b7
5 changed files with 28 additions and 11 deletions

View File

@@ -213,17 +213,21 @@ Calculation::EqualSign Calculation::exactAndApproximateDisplayedOutputsAreEqual(
}
}
Calculation::AdditionalOutput Calculation::additionalOuput(Context * context) {
Calculation::AdditionalOutput Calculation::additionalOuput(Context * context, std::complex<float> * c) {
ExpressionNode::Type type = exactOutput().type();
if (type == ExpressionNode::Type::Rational) {
return AdditionalOutput::BaseRepresentation;
}
Preferences * preferences = Preferences::sharedPreferences();
Evaluation<float> e = approximateOutput(context).approximateToEvaluation<float>(context, preferences->complexFormat(), preferences->angleUnit());
Evaluation<float> e = approximateOutput(context).approximateToEvaluation<float>(context, Preferences::ComplexFormat::Cartesian, preferences->angleUnit());
if (e.type() == EvaluationNode<float>::Type::MatrixComplex) {
return AdditionalOutput::None;
}
Complex<float> ec = static_cast<Complex<float> &>(e);
if (c) {
c->real(ec.real());
c->imag(ec.imag());
}
// return AdditionalOutput::Matrix
if ((type == ExpressionNode::Type::Cosine || type == ExpressionNode::Type::Sine) && ec.imag() == 0.0f) {
return AdditionalOutput::TrigonometryCircle;