[apps] Code cleaning

This commit is contained in:
Léa Saviot
2019-09-03 14:20:54 +02:00
parent c3ee6a71e7
commit 4ecf6835e7
2 changed files with 5 additions and 17 deletions

View File

@@ -59,9 +59,6 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa
float resultyMax = -FLT_MAX;
float xMin = const_cast<GraphController *>(this)->interactiveCurveViewRange()->xMin();
float xMax = const_cast<GraphController *>(this)->interactiveCurveViewRange()->xMax();
/* In practice, a step smaller than a pixel's width is needed for sampling
* the values of a function. Otherwise some relevant extremal values may be
* missed. */
assert(functionStore()->numberOfActiveFunctions() > 0);
if (displaysNonCartesianFunctions()) {
for (int i = 0; i < functionStore()->numberOfActiveFunctions(); i++) {
@@ -106,10 +103,6 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa
}
float GraphController::interestingXHalfRange() const {
if (displaysNonCartesianFunctions())
{
return 5.0f;
}
float characteristicRange = 0.0f;
Poincare::Context * context = textFieldDelegateApp()->localContext();
CartesianFunctionStore * store = functionStore();

View File

@@ -152,16 +152,9 @@ void InteractiveCurveViewRange::setDefault() {
m_yAuto = true;
return;
}
#if 0
m_yAuto = false;
m_xMax = NormalizedXHalfRange();
setXMin(-NormalizedXHalfRange());
m_yMax = NormalizedYHalfRange();
setYMin(-NormalizedYHalfRange());
normalize();
#else
m_yAuto = false;
m_yAuto = false;
// Compute the interesting ranges
float a,b,c,d;
m_delegate->interestingRanges(&a, &b, &c, &d);
MemoizedCurveViewRange::setXMin(a);
@@ -169,12 +162,15 @@ void InteractiveCurveViewRange::setDefault() {
MemoizedCurveViewRange::setYMin(c);
MemoizedCurveViewRange::setYMax(d);
// Add margins
float xRange = m_xMax - m_xMin;
float yRange = m_yMax - m_yMin;
m_xMin = m_delegate->addMargin(m_xMin, xRange, false, true);
MemoizedCurveViewRange::setXMax(m_delegate->addMargin(m_xMax, xRange, false, false));
m_yMin = m_delegate->addMargin(m_yMin, yRange, true, true);
MemoizedCurveViewRange::setYMax(m_delegate->addMargin(m_yMax, yRange, true, false));
// Normalize the axes, so that a polar circle is displayed as a circle
xRange = m_xMax - m_xMin;
yRange = m_yMax - m_yMin;
float xyRatio = xRange/yRange;
@@ -192,7 +188,6 @@ void InteractiveCurveViewRange::setDefault() {
m_yMin -= delta;
MemoizedCurveViewRange::setYMax(m_yMax+delta);
}
#endif
}
void InteractiveCurveViewRange::centerAxisAround(Axis axis, float position) {