mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/graph] DefDomain depends on angleUnit
When automatically setting the definition domain of a non-cartesian curve, take into account the angle unit: 0..360 for Degrees, 0..400 for gradians...
This commit is contained in:
committed by
EmilieNumworks
parent
aa0f388e0a
commit
22c7fb440e
@@ -24,7 +24,7 @@ bool TypeParameterController::handleEvent(Ion::Events::Event event) {
|
||||
App * myApp = App::app();
|
||||
assert(!m_record.isNull());
|
||||
Shared::ExpiringPointer<Shared::CartesianFunction> function = myApp->functionStore()->modelForRecord(m_record);
|
||||
function->setPlotType(plotType);
|
||||
function->setPlotType(plotType, Poincare::Preferences::sharedPreferences()->angleUnit());
|
||||
StackViewController * stack = stackController();
|
||||
stack->pop();
|
||||
stack->pop();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <poincare/multiplication.h>
|
||||
#include <poincare/rational.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
#include <poincare/trigonometry.h>
|
||||
#include <escher/palette.h>
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
#include <apps/i18n.h>
|
||||
@@ -119,7 +120,7 @@ CartesianFunction::PlotType CartesianFunction::plotType() const {
|
||||
return recordData()->plotType();
|
||||
}
|
||||
|
||||
void CartesianFunction::setPlotType(PlotType newPlotType) {
|
||||
void CartesianFunction::setPlotType(PlotType newPlotType, Poincare::Preferences::AngleUnit angleUnit) {
|
||||
PlotType currentPlotType = plotType();
|
||||
if (newPlotType == currentPlotType) {
|
||||
return;
|
||||
@@ -132,7 +133,7 @@ void CartesianFunction::setPlotType(PlotType newPlotType) {
|
||||
|
||||
// Recompute the definition domain
|
||||
double tMin = newPlotType == PlotType::Cartesian ? -INFINITY : 0.0;
|
||||
double tMax = newPlotType == PlotType::Cartesian ? INFINITY : 2.0*M_PI;
|
||||
double tMax = newPlotType == PlotType::Cartesian ? INFINITY : 2.0*Trigonometry::PiInAngleUnit(angleUnit);
|
||||
setTMin(tMin);
|
||||
setTMax(tMax);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
Parametric = 2
|
||||
};
|
||||
PlotType plotType() const;
|
||||
void setPlotType(PlotType plotType);
|
||||
void setPlotType(PlotType plotType, Poincare::Preferences::AngleUnit angleUnit);
|
||||
static I18n::Message ParameterMessageForPlotType(PlotType plotType);
|
||||
|
||||
// Evaluation
|
||||
|
||||
Reference in New Issue
Block a user