/*****************************************************************************
** FILE IDENTIFICATION
**
-** EZPLOT
+** ezplot.cpp
**
** This is part of the CTSim program
-** Copyright (c) 1983-2001 Kevin Rosenberg
-**
-** $Id$
+** Copyright (c) 1983-2009 Kevin Rosenberg
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
int
EZPlot::axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp)
{
- if (min >= max || nint < 1) {
- sys_error (ERR_WARNING, "Invalid params: min=%lf, max=%lf, num intervals=%d [axis_scale]", min, max, nint);
+ if (nint < 1) {
+ sys_error (ERR_WARNING, "No intervals to plot: num intervals=%d [axis_scale]", nint);
return (FALSE);
}
+ if (min >= max) {
+ double scaled = fabs(max) / 10;
+ if (scaled == 0)
+ scaled = 0.1;
+ *minp = min - scaled;
+ *maxp = max + scaled;
+ *nintp = 2;
+ return (TRUE);
+ }
double eps = 0.025;
double a = fabs(min);