Ignore:
Timestamp:
Apr 2, 2012, 1:44:45 AM (8 years ago)
Author:
ldelgass
Message:

style fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Axis.cpp

    r2871 r2923  
    3232}
    3333
    34 /*
    35  * ----------------------------------------------------------------------
    36  *
    37  * NiceNum --
    38  *
    39  *      Reference: Paul Heckbert, "Nice Numbers for Graph Labels",
    40  *                 Graphics Gems, pp 61-63. 
    41  *
    42  *      Finds a "nice" number approximately equal to x.
    43  *
    44  * ----------------------------------------------------------------------
     34/**
     35 * Reference: Paul Heckbert, "Nice Numbers for Graph Labels",
     36 *            Graphics Gems, pp 61-63. 
     37 *
     38 * Finds a "nice" number approximately equal to x.
    4539 */
    4640static double
    47 NiceNum(
    48     double x,
    49     int round)                  /* If non-zero, round. Otherwise take ceiling
    50                                  * of value. */
    51 {
    52     double expt;                /* Exponent of x */
    53     double frac;                /* Fractional part of x */
    54     double nice;                /* Nice, rounded fraction */
     41niceNum(double x,
     42        int round)              /* If non-zero, round. Otherwise take ceiling
     43                                 * of value. */
     44{
     45    double expt;                /* Exponent of x */
     46    double frac;                /* Fractional part of x */
     47    double nice;                /* Nice, rounded fraction */
    5548
    5649    expt = floor(log10(x));
    57     frac = x / EXP10(expt);     /* between 1 and 10 */
     50    frac = x / EXP10(expt);     /* between 1 and 10 */
    5851    if (round) {
    59         if (frac < 1.5) {
    60             nice = 1.0;
    61         } else if (frac < 3.0) {
    62             nice = 2.0;
    63         } else if (frac < 7.0) {
    64             nice = 5.0;
    65         } else {
    66             nice = 10.0;
    67         }
     52        if (frac < 1.5) {
     53            nice = 1.0;
     54        } else if (frac < 3.0) {
     55            nice = 2.0;
     56        } else if (frac < 7.0) {
     57            nice = 5.0;
     58        } else {
     59            nice = 10.0;
     60        }
    6861    } else {
    69         if (frac <= 1.0) {
    70             nice = 1.0;
    71         } else if (frac <= 2.0) {
    72             nice = 2.0;
    73         } else if (frac <= 5.0) {
    74             nice = 5.0;
    75         } else {
    76             nice = 10.0;
    77         }
     62        if (frac <= 1.0) {
     63            nice = 1.0;
     64        } else if (frac <= 2.0) {
     65            nice = 2.0;
     66        } else if (frac <= 5.0) {
     67            nice = 5.0;
     68        } else {
     69            nice = 10.0;
     70        }
    7871    }
    7972    return nice * EXP10(expt);
     
    8174
    8275void
    83 Ticks::SetTicks()
     76Ticks::setTicks()
    8477{
    8578    _numTicks = 0;
    8679    _ticks = new float[_nSteps];
    8780    if (_step == 0.0) {
    88         /* Hack: A zero step indicates to use log values. */
    89         unsigned int i;
    90         /* Precomputed log10 values [1..10] */
    91         static double logTable[] = {
    92             0.0,
    93             0.301029995663981,
    94             0.477121254719662,
    95             0.602059991327962,
    96             0.698970004336019,
    97             0.778151250383644,
    98             0.845098040014257,
    99             0.903089986991944,
    100             0.954242509439325,
    101             1.0
    102         };
    103         for (i = 0; i < _nSteps; i++) {
    104             _ticks[i] = logTable[i];
    105         }
     81        /* Hack: A zero step indicates to use log values. */
     82        unsigned int i;
     83        /* Precomputed log10 values [1..10] */
     84        static double logTable[] = {
     85            0.0,
     86            0.301029995663981,
     87            0.477121254719662,
     88            0.602059991327962,
     89            0.698970004336019,
     90            0.778151250383644,
     91            0.845098040014257,
     92            0.903089986991944,
     93            0.954242509439325,
     94            1.0
     95        };
     96        for (i = 0; i < _nSteps; i++) {
     97            _ticks[i] = logTable[i];
     98        }
    10699    } else {
    107         double value;
    108         unsigned int i;
     100        double value;
     101        unsigned int i;
    109102   
    110         value = _initial;       /* Start from smallest axis tick */
    111         for (i = 0; i < _nSteps; i++) {
    112             value = _initial + (_step * i);
    113             _ticks[i] = UROUND(value, _step);
    114         }
     103        value = _initial;        /* Start from smallest axis tick */
     104        for (i = 0; i < _nSteps; i++) {
     105            value = _initial + (_step * i);
     106            _ticks[i] = UROUND(value, _step);
     107        }
    115108    }
    116109    _numTicks = _nSteps;
     
    136129}
    137130
    138 /*
    139  * ----------------------------------------------------------------------
    140  *
    141  * InRange --
    142  *
    143  *      Determines if a value lies within a given range.
    144  *
    145  *      The value is normalized by the current axis range. If the normalized
    146  *      value is between [0.0..1.0] then it's in range.  The value is compared
    147  *      to 0 and 1., where 0.0 is the minimum and 1.0 is the maximum.
    148  *      DBL_EPSILON is the smallest number that can be represented on the host
    149  *      machine, such that (1.0 + epsilon) != 1.0.
    150  *
    151  *      Please note, *max* can't equal *min*.
    152  *
    153  * Results:
    154  *      If the value is within the interval [min..max], 1 is returned; 0
    155  *      otherwise.
    156  *
    157  * ----------------------------------------------------------------------
     131/**
     132 * \brief Determines if a value lies within a given range.
     133 *
     134 * The value is normalized by the current axis range. If the normalized
     135 * value is between [0.0..1.0] then it's in range.  The value is compared
     136 * to 0 and 1., where 0.0 is the minimum and 1.0 is the maximum.
     137 * DBL_EPSILON is the smallest number that can be represented on the host
     138 * machine, such that (1.0 + epsilon) != 1.0.
     139 *
     140 * Please note, *max* can't equal *min*.
     141 *
     142 * \return If the value is within the interval [min..max], 1 is returned; 0
     143 * otherwise.
    158144 */
    159145bool
    160 Axis::InRange(double x)
     146Axis::inRange(double x)
    161147{
    162148    if (_range < DBL_EPSILON) {
    163         return (fabs(_max - x) >= DBL_EPSILON);
     149        return (fabs(_max - x) >= DBL_EPSILON);
    164150    } else {
    165         x = (x - _min) * _scale;
    166         return ((x >= -DBL_EPSILON) && ((x - 1.0) < DBL_EPSILON));
     151        x = (x - _min) * _scale;
     152        return ((x >= -DBL_EPSILON) && ((x - 1.0) < DBL_EPSILON));
    167153    }
    168154}
    169155
    170156void
    171 Axis::FixRange(double min, double max)
     157Axis::fixRange(double min, double max)
    172158{
    173159    if (min == DBL_MAX) {
    174         if (DEFINED(_reqMin)) {
    175             min = _reqMin;
    176         } else {
    177             min = (_flags & LOGSCALE) ? 0.001 : 0.0;
    178         }
     160        if (DEFINED(_reqMin)) {
     161            min = _reqMin;
     162        } else {
     163            min = (_flags & LOGSCALE) ? 0.001 : 0.0;
     164        }
    179165    }
    180166    if (max == -DBL_MAX) {
    181         if (DEFINED(_reqMax)) {
    182             max = _reqMax;
    183         } else {
    184             max = 1.0;
    185         }
     167        if (DEFINED(_reqMax)) {
     168            max = _reqMax;
     169        } else {
     170            max = 1.0;
     171        }
    186172    }
    187173    if (min >= max) {
    188         /*
    189         * There is no range of data (i.e. min is not less than max), so
    190         * manufacture one.
    191         */
    192         if (min == 0.0) {
    193             min = 0.0, max = 1.0;
    194         } else {
    195             max = min + (fabs(min) * 0.1);
    196         }
     174        /*
     175        * There is no range of data (i.e. min is not less than max), so
     176        * manufacture one.
     177        */
     178        if (min == 0.0) {
     179            min = 0.0, max = 1.0;
     180        } else {
     181            max = min + (fabs(min) * 0.1);
     182        }
    197183    }
    198184
     
    204190    _valueMax = (DEFINED(_reqMax)) ? _reqMax : max;
    205191    if (_valueMax < _valueMin) {
    206         /*   
    207          * If the limits still don't make sense, it's because one limit
    208          * configuration option (-min or -max) was set and the other default
    209          * (based upon the data) is too small or large.  Remedy this by making
    210          * up a new min or max from the user-defined limit.
    211          */
    212         if (!DEFINED(_reqMin)) {
    213             _valueMin = _valueMax - (fabs(_valueMax) * 0.1);
    214         }
    215         if (!DEFINED(_reqMax)) {
    216             _valueMax = _valueMin + (fabs(_valueMax) * 0.1);
    217         }
    218     }
    219 }
    220 
    221 /*
    222  * ----------------------------------------------------------------------
    223  *
    224  * LogScale --
    225  *
    226  *      Determine the range and units of a log scaled axis.
    227  *
    228  *      Unless the axis limits are specified, the axis is scaled
    229  *      automatically, where the smallest and largest major ticks encompass
    230  *      the range of actual data values.  When an axis limit is specified,
    231  *      that value represents the smallest(min)/largest(max) value in the
    232  *      displayed range of values.
    233  *
    234  *      Both manual and automatic scaling are affected by the step used.  By
    235  *      default, the step is the largest power of ten to divide the range in
    236  *      more than one piece.
    237  *
    238  *      Automatic scaling:
    239  *      Find the smallest number of units which contain the range of values.
    240  *      The minimum and maximum major tick values will be represent the
    241  *      range of values for the axis. This greatest number of major ticks
    242  *      possible is 10.
    243  *
    244  *      Manual scaling:
    245  *      Make the minimum and maximum data values the represent the range of
    246  *      the values for the axis.  The minimum and maximum major ticks will be
    247  *      inclusive of this range.  This provides the largest area for plotting
    248  *      and the expected results when the axis min and max values have be set
    249  *      by the user (.e.g zooming).  The maximum number of major ticks is 20.
    250  *
    251  *      For log scale, there's the possibility that the minimum and
    252  *      maximum data values are the same magnitude.  To represent the
    253  *      points properly, at least one full decade should be shown.
    254  *      However, if you zoom a log scale plot, the results should be
    255  *      predictable. Therefore, in that case, show only minor ticks.
    256  *      Lastly, there should be an appropriate way to handle numbers
    257  *      <=0.
    258  *
     192        /*   
     193         * If the limits still don't make sense, it's because one limit
     194         * configuration option (-min or -max) was set and the other default
     195         * (based upon the data) is too small or large.  Remedy this by making
     196         * up a new min or max from the user-defined limit.
     197         */
     198        if (!DEFINED(_reqMin)) {
     199            _valueMin = _valueMax - (fabs(_valueMax) * 0.1);
     200        }
     201        if (!DEFINED(_reqMax)) {
     202            _valueMax = _valueMin + (fabs(_valueMax) * 0.1);
     203        }
     204    }
     205}
     206
     207/**
     208 * \brief Determine the range and units of a log scaled axis.
     209 *
     210 * Unless the axis limits are specified, the axis is scaled
     211 * automatically, where the smallest and largest major ticks encompass
     212 * the range of actual data values.  When an axis limit is specified,
     213 * that value represents the smallest(min)/largest(max) value in the
     214 * displayed range of values.
     215 *
     216 * Both manual and automatic scaling are affected by the step used.  By
     217 * default, the step is the largest power of ten to divide the range in
     218 * more than one piece.
     219 *
     220 * Automatic scaling:
     221 * Find the smallest number of units which contain the range of values.
     222 * The minimum and maximum major tick values will be represent the
     223 * range of values for the axis. This greatest number of major ticks
     224 * possible is 10.
     225 *
     226 * Manual scaling:
     227 * Make the minimum and maximum data values the represent the range of
     228 * the values for the axis.  The minimum and maximum major ticks will be
     229 * inclusive of this range.  This provides the largest area for plotting
     230 * and the expected results when the axis min and max values have be set
     231 * by the user (.e.g zooming).  The maximum number of major ticks is 20.
     232 *
     233 * For log scale, there's the possibility that the minimum and
     234 * maximum data values are the same magnitude.  To represent the
     235 * points properly, at least one full decade should be shown.
     236 * However, if you zoom a log scale plot, the results should be
     237 * predictable. Therefore, in that case, show only minor ticks.
     238 * Lastly, there should be an appropriate way to handle numbers
     239 * <=0.
     240 * <pre>
    259241 *          maxY
    260242 *            |    units = magnitude (of least significant digit)
     
    279261 *           minY
    280262 *
    281  *
    282  *      numTicks = Number of ticks
    283  *      min = Minimum value of axis
    284  *      max = Maximum value of axis
    285  *      range    = Range of values (max - min)
    286  *
    287  *      If the number of decades is greater than ten, it is assumed
    288  *      that the full set of log-style ticks can't be drawn properly.
    289  *
    290  * Results:
    291  *      None
    292  *
    293  * ---------------------------------------------------------------------- */
     263 *      numTicks = Number of ticks
     264 *      min = Minimum value of axis
     265 *      max = Maximum value of axis
     266 *      range = Range of values (max - min)
     267 *
     268 * </pre>
     269 *
     270 *      If the number of decades is greater than ten, it is assumed
     271 *      that the full set of log-style ticks can't be drawn properly.
     272 */
    294273void
    295 Axis::LogScale()
     274Axis::logScale()
    296275{
    297276    double range;
     
    307286    min = _valueMin, max = _valueMax;
    308287    if (min < max) {
    309         min = (min != 0.0) ? log10(fabs(min)) : 0.0;
    310         max = (max != 0.0) ? log10(fabs(max)) : 1.0;
    311 
    312         tickMin = floor(min);
    313         tickMax = ceil(max);
    314         range = tickMax - tickMin;
    315        
    316         if (range > 10) {
    317             /* There are too many decades to display a major tick at every
    318              * decade.  Instead, treat the axis as a linear scale.  */
    319             range = NiceNum(range, 0);
    320             majorStep = NiceNum(range / _major.reqNumTicks, 1);
    321             tickMin = UFLOOR(tickMin, majorStep);
    322             tickMax = UCEIL(tickMax, majorStep);
    323             nMajor = (int)((tickMax - tickMin) / majorStep) + 1;
    324             minorStep = EXP10(floor(log10(majorStep)));
    325             if (minorStep == majorStep) {
    326                 nMinor = 4, minorStep = 0.2;
    327             } else {
    328                 nMinor = ROUND(majorStep / minorStep) - 1;
    329             }
    330         } else {
    331             if (tickMin == tickMax) {
    332                 tickMax++;
    333             }
    334             majorStep = 1.0;
    335             nMajor = (int)(tickMax - tickMin + 1); /* FIXME: Check this. */
    336            
    337             minorStep = 0.0;    /* This is a special hack to pass
    338                                 * information to the SetTicks
    339                                 * method. An interval of 0.0 indicates
    340                                  *      1) this is a minor sweep and
    341                                  *      2) the axis is log scale. 
    342                                 */
    343             nMinor = 10;
    344         }
    345         if ((_flags & TIGHT_MIN) || (DEFINED(_reqMin))) {
    346             tickMin = min;
    347             nMajor++;
    348         }
    349         if ((_flags & TIGHT_MAX) || (DEFINED(_reqMax))) {
    350             tickMax = max;
    351         }
    352     }
    353     _major.SetValues(floor(tickMin), majorStep, nMajor);
    354     _minor.SetValues(minorStep, minorStep, nMinor);
     288        min = (min != 0.0) ? log10(fabs(min)) : 0.0;
     289        max = (max != 0.0) ? log10(fabs(max)) : 1.0;
     290
     291        tickMin = floor(min);
     292        tickMax = ceil(max);
     293        range = tickMax - tickMin;
     294       
     295        if (range > 10) {
     296            /* There are too many decades to display a major tick at every
     297             * decade.  Instead, treat the axis as a linear scale.  */
     298            range = niceNum(range, 0);
     299            majorStep = niceNum(range / _major.reqNumTicks, 1);
     300            tickMin = UFLOOR(tickMin, majorStep);
     301            tickMax = UCEIL(tickMax, majorStep);
     302            nMajor = (int)((tickMax - tickMin) / majorStep) + 1;
     303            minorStep = EXP10(floor(log10(majorStep)));
     304            if (minorStep == majorStep) {
     305                nMinor = 4, minorStep = 0.2;
     306            } else {
     307                nMinor = ROUND(majorStep / minorStep) - 1;
     308            }
     309        } else {
     310            if (tickMin == tickMax) {
     311                tickMax++;
     312            }
     313            majorStep = 1.0;
     314            nMajor = (int)(tickMax - tickMin + 1); /* FIXME: Check this. */
     315           
     316            minorStep = 0.0;    /* This is a special hack to pass
     317                                * information to the SetTicks
     318                                * method. An interval of 0.0 indicates
     319                                 *   1) this is a minor sweep and
     320                                 *   2) the axis is log scale. 
     321                                */
     322            nMinor = 10;
     323        }
     324        if ((_flags & TIGHT_MIN) || (DEFINED(_reqMin))) {
     325            tickMin = min;
     326            nMajor++;
     327        }
     328        if ((_flags & TIGHT_MAX) || (DEFINED(_reqMax))) {
     329            tickMax = max;
     330        }
     331    }
     332    _major.setValues(floor(tickMin), majorStep, nMajor);
     333    _minor.setValues(minorStep, minorStep, nMinor);
    355334    _min = tickMin;
    356335    _max = tickMax;
     
    359338}
    360339
    361 /*
    362  * ----------------------------------------------------------------------
    363  *
    364  * Axis::LinearScale --
    365  *
    366  *      Determine the units of a linear scaled axis.
    367  *
    368  *      The axis limits are either the range of the data values mapped
    369  *      to the axis (autoscaled), or the values specified by the -min
    370  *      and -max options (manual).
    371  *
    372  *      If autoscaled, the smallest and largest major ticks will
    373  *      encompass the range of data values.  If the -loose option is
    374  *      selected, the next outer ticks are choosen.  If tight, the
    375  *      ticks are at or inside of the data limits are used.
    376  *
    377  *      If manually set, the ticks are at or inside the data limits
    378  *      are used.  This makes sense for zooming.  You want the
    379  *      selected range to represent the next limit, not something a
    380  *      bit bigger.
    381  *
    382  *      Note: I added an "always" value to the -loose option to force
    383  *            the manually selected axes to be loose. It's probably
    384  *            not a good idea.
    385  *
     340/**
     341 * \brief Determine the units of a linear scaled axis.
     342 *
     343 * The axis limits are either the range of the data values mapped
     344 * to the axis (autoscaled), or the values specified by the -min
     345 * and -max options (manual).
     346 *
     347 * If autoscaled, the smallest and largest major ticks will
     348 * encompass the range of data values.  If the -loose option is
     349 * selected, the next outer ticks are choosen.  If tight, the
     350 * ticks are at or inside of the data limits are used.
     351 *
     352 * If manually set, the ticks are at or inside the data limits
     353 * are used.  This makes sense for zooming.  You want the
     354 * selected range to represent the next limit, not something a
     355 * bit bigger.
     356 *
     357 * Note: I added an "always" value to the -loose option to force
     358 * the manually selected axes to be loose. It's probably
     359 * not a good idea.
     360 *
     361 * <pre>
    386362 *          maxY
    387363 *            |    units = magnitude (of least significant digit)
     
    409385 *      min = Minimum value of axis
    410386 *      max = Maximum value of axis
    411  *      range    = Range of values (max - min)
    412  *
    413  * Results:
    414  *      None.
     387 *      range = Range of values (max - min)
     388 *
     389 * </pre>
    415390 *
    416391 * Side Effects:
    417392 *      The axis tick information is set.  The actual tick values will
    418393 *      be generated later.
    419  *
    420  * ----------------------------------------------------------------------
    421394 */
    422395void
    423 Axis::LinearScale()
     396Axis::linearScale()
    424397{
    425398    double step;
     
    432405    tickMin = tickMax = 0.0;
    433406    if (_valueMin < _valueMax) {
    434         double range;
    435 
    436         range = _valueMax - _valueMin;
    437         /* Calculate the major tick stepping. */
    438         if (_reqStep > 0.0) {
    439             /* An interval was designated by the user.  Keep scaling it until
    440              * it fits comfortably within the current range of the axis.  */
    441             step = _reqStep;
    442             while ((2 * step) >= range) {
    443                 step *= 0.5;
    444             }
    445         } else {
    446             range = NiceNum(range, 0);
    447             step = NiceNum(range / _major.reqNumTicks, 1);
    448         }
    449        
    450         /* Find the outer tick values. Add 0.0 to prevent getting -0.0. */
    451         tickMin = floor(_valueMin / step) * step + 0.0;
    452         tickMax = ceil(_valueMax / step) * step + 0.0;
    453        
    454         nTicks = ROUND((tickMax - tickMin) / step) + 1;
     407        double range;
     408
     409        range = _valueMax - _valueMin;
     410        /* Calculate the major tick stepping. */
     411        if (_reqStep > 0.0) {
     412            /* An interval was designated by the user.  Keep scaling it until
     413             * it fits comfortably within the current range of the axis.  */
     414            step = _reqStep;
     415            while ((2 * step) >= range) {
     416                step *= 0.5;
     417            }
     418        } else {
     419            range = niceNum(range, 0);
     420            step = niceNum(range / _major.reqNumTicks, 1);
     421        }
     422       
     423        /* Find the outer tick values. Add 0.0 to prevent getting -0.0. */
     424        tickMin = floor(_valueMin / step) * step + 0.0;
     425        tickMax = ceil(_valueMax / step) * step + 0.0;
     426       
     427        nTicks = ROUND((tickMax - tickMin) / step) + 1;
    455428    }
    456     _major.SetValues(tickMin, step, nTicks);
     429    _major.setValues(tickMin, step, nTicks);
    457430
    458431    /*
     
    472445
    473446    if ((_minor.reqNumTicks > 0) && (_minor.autoscale())) {
    474         nTicks = _minor.reqNumTicks - 1;
    475         step = 1.0 / (nTicks + 1);
     447        nTicks = _minor.reqNumTicks - 1;
     448        step = 1.0 / (nTicks + 1);
    476449    } else {
    477         nTicks = 0;             /* No minor ticks. */
    478         step = 0.5;             /* Don't set the minor tick interval to
    479                                 * 0.0. It makes the GenerateTicks routine
    480                                 * create minor log-scale tick marks.  */
    481     }
    482     _minor.SetValues(step, step, nTicks);
     450        nTicks = 0;             /* No minor ticks. */
     451        step = 0.5;             /* Don't set the minor tick interval to
     452                                * 0.0. It makes the GenerateTicks routine
     453                                * create minor log-scale tick marks.  */
     454    }
     455    _minor.setValues(step, step, nTicks);
    483456}
    484457
    485458
    486459void
    487 Axis::SetScale(double min, double max)
    488 {
    489     FixRange(min, max);
     460Axis::setScale(double min, double max)
     461{
     462    fixRange(min, max);
    490463    if (_flags & LOGSCALE) {
    491         LogScale();
     464        logScale();
    492465    } else {
    493         LinearScale();
    494     }
    495     _major.SweepTicks();
    496     _minor.SweepTicks();
    497     MakeTicks();
     466        linearScale();
     467    }
     468    _major.sweepTicks();
     469    _minor.sweepTicks();
     470    makeTicks();
    498471}
    499472
    500473void
    501 Axis::MakeTicks()
    502 {
    503     _major.Reset();
    504     _minor.Reset();
     474Axis::makeTicks()
     475{
     476    _major.reset();
     477    _minor.reset();
    505478    int i;
    506479    for (i = 0; i < _major.numTicks(); i++) {
    507         double t1, t2;
    508         int j;
    509        
    510         t1 = _major.tick(i);
    511         /* Minor ticks */
    512         for (j = 0; j < _minor.numTicks(); j++) {
    513             t2 = t1 + (_major.step() * _minor.tick(j));
    514             if (!InRange(t2)) {
    515                 continue;
    516             }
    517             if (t1 == t2) {
    518                 continue;       // Don't add duplicate minor ticks.
    519             }
    520             _minor.Append(t2);
    521         }
    522         if (!InRange(t1)) {
    523             continue;
    524         }
    525         _major.Append(t1);
     480        double t1, t2;
     481        int j;
     482       
     483        t1 = _major.tick(i);
     484        /* Minor ticks */
     485        for (j = 0; j < _minor.numTicks(); j++) {
     486            t2 = t1 + (_major.step() * _minor.tick(j));
     487            if (!inRange(t2)) {
     488                continue;
     489            }
     490            if (t1 == t2) {
     491                continue;        // Don't add duplicate minor ticks.
     492            }
     493            _minor.append(t2);
     494        }
     495        if (!inRange(t1)) {
     496            continue;
     497        }
     498        _major.append(t1);
    526499    }
    527500}
    528501
    529502double
    530 Axis::Map(double x)
     503Axis::map(double x)
    531504{
    532505    if ((_flags & LOGSCALE) && (x != 0.0)) {
    533         x = log10(fabs(x));
     506        x = log10(fabs(x));
    534507    }
    535508    /* Map graph coordinate to normalized coordinates [0..1] */
    536509    x = (x - _min) * _scale;
    537510    if (_flags & DESCENDING) {
    538         x = 1.0 - x;
     511        x = 1.0 - x;
    539512    }
    540513    return x;
     
    542515
    543516double
    544 Axis::InvMap(double x)
     517Axis::invMap(double x)
    545518{
    546519    if (_flags & DESCENDING) {
    547         x = 1.0 - x;
     520        x = 1.0 - x;
    548521    }
    549522    x = (x * _range) + _min;
    550523    if (_flags & LOGSCALE) {
    551         x = EXP10(x);
     524        x = EXP10(x);
    552525    }
    553526    return x;
Note: See TracChangeset for help on using the changeset viewer.