Files
Upsilon/apps/shared/interactive_curve_view_range_delegate.h
Gabriel Ozouf 8104caea50 [apps/shared] New automatic zoom on curves
Initial zoom for displaying curves is computed according to the
following rules :
  - For polar and parametric curves, the algorithm has not changed.
    Vertical and horizontal ranges are chosen in order to display the
    full curve with orthonormal graduations.
  - For cartesian curves, the horizontal range is chosen in order to
    display all points of interest (roots, extrema, asymptotes...).
    The vertical range is fitted to be able to display those points, but
    also cuts out points outside of the function's order of magnitude.

Change-Id: Idf8233fc2e6586b85d34c4da152c83e75513d85c
2020-11-04 15:30:53 +01:00

30 lines
873 B
C++

#ifndef SHARED_INTERACTIVE_CURVE_VIEW_DELEGATE_H
#define SHARED_INTERACTIVE_CURVE_VIEW_DELEGATE_H
#include <assert.h>
namespace Shared {
class InteractiveCurveViewRange;
class InteractiveCurveViewRangeDelegate {
public:
bool didChangeRange(InteractiveCurveViewRange * interactiveCurveViewRange);
virtual float interestingXMin() const { return -interestingXHalfRange(); }
virtual float interestingXHalfRange() const { return 10.0f; }
virtual bool defaultRangeIsNormalized() const { return false; }
virtual void interestingRanges(float * xm, float * xM, float * ym, float * yM) const { assert(false); }
virtual float addMargin(float x, float range, bool isVertical, bool isMin) = 0;
protected:
struct Range {
float min;
float max;
};
private:
virtual Range computeYRange(InteractiveCurveViewRange * interactiveCurveViewRange) = 0;
};
}
#endif