Skip to content
Snippets Groups Projects
axis.hpp 1.64 KiB
Newer Older
//**************************************************************************************************
//*  FRIDA: fast reliable interactive data analysis                        
//*  (C) Joachim Wuttke 1990-, v2(C++) 2001-                               
//*  http://apps.jcns.fz-juelich.de/frida                                  
//**************************************************************************************************
Wuttke, Joachim's avatar
Wuttke, Joachim committed
//! \file  axis.hpp
//! \brief CAxis: One axis of a coordinate frame.
Wuttke, Joachim's avatar
..  
Wuttke, Joachim committed

//! One axis of a coordinate frame, for use in plotting.
class CAxis {
 public:
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    std::string name;     //!< usually "x" or "y"
    double inf;      //!< infimum: lower plot limit
    double sup;      //!< supremum: upper plot limit
    bool   logflag;  //!< is logarithmic ?
    bool   force;    //!< force points into range ?
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    CAxis( const std::string _name, bool _log ) :
        name(_name), logflag(_log), force(false) { set_auto(); }
    void set_auto();
    void set_limits( double _inf, double _sup );
    void set_rounded_limits( double _inf, double _sup );
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    void ask_and_set( const std::string& quest );
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    std::string str() const;
    std::string info() const;
    bool finite() const;
    bool contains( double val ) const;
    bool close_enough( double v1, double v2, double tol ) const;
    double value2plotcoord( double v ) const;
    double value2ploterror( double v, double dv ) const;
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    void set_xgrid( std::vector<double>& x, int n ) const;
    double pc( double v ) const;
    double pcerr( double v, double dv ) const;
Wuttke, Joachim's avatar
Wuttke, Joachim committed
    void calc_ticks( std::vector<double>& Tacks, int *ntpt, double *ticklim ) const;