TridHistoGLFrame.cxx File Reference

#include "TridHistoGLFrame.h"
#include "TridPage.h"
#include "TridSketches.h"
#include "TridOpenGLGlobal.h"
#include "TridControl.h"
#include "TROOT.h"
#include "TGX11.h"
#include "TVirtualX.h"
#include "KeySymbols.h"
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glu.h>
#include "glf.h"
#include <cassert>
#include <iostream>
#include <cmath>

Go to the source code of this file.

Functions

double GetGoodTickWidth (double min, double max, double maxticks, char *format)

Function Documentation

double GetGoodTickWidth ( double  min,
double  max,
double  maxticks,
char *  format 
)

Definition at line 176 of file TridHistoGLFrame.cxx.

Referenced by TridHistoGLFrame::DrawObjects().

00177 {
00178   double dumbTickWidth = (max-min)/maxticks;
00179   //cout << "Dumb width " << dumbTickWidth << endl;
00180   double thelog = log10(dumbTickWidth);
00181   double multiplier = pow(10,floor(thelog));
00182   double abcissa = pow(10,thelog)/multiplier; // Gives a number between 1 and 9.999
00183   double goodTickWidth;
00184   //if(abcissa<3.0) {
00185   //  goodTickWidth = 1.0*multiplier;
00186   //} else if(abcissa>3.0 && abcissa<7.0) {
00187   int sigfigs = 1;
00188   if(abcissa<3.0) {
00189     goodTickWidth = 2.5*multiplier;
00190     sigfigs = 2;
00191   }  else if(abcissa<7.0) {
00192     goodTickWidth = 5.0*multiplier;
00193   } else {
00194     goodTickWidth = 10.0 * multiplier;
00195   }
00196 
00197   double extreme = fabs(max);
00198   if(fabs(min)>fabs(max)) extreme = fabs(min);
00199   if(format) {
00200     if(extreme>10000) strcpy(format,"%1.1e");
00201     else if(extreme>10) strcpy(format,"%1.1f");
00202     else if(extreme>1) strcpy(format,"%1.1f");
00203     else if(extreme>0.001) strcpy(format,"%g");
00204     else strcpy(format,"%1.1e");
00205   }
00206   //cout << "Good width " << goodTickWidth << endl;
00207   return goodTickWidth;
00208 }


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1