Programming and Graphics

(Kiana) #1

238 Introduction to C++ Programming and Graphics


move (xmin, ymax+0.3*ymargin,zmin-0.8*zmargin);
drawstr(labely);
move (xmin-0.8*xmargin, ymin, zmax+0.50*ticz);
drawstr(labelz);

//--- Draw ticks:

if(Itick==1)
{

float tchx = 0.4*xmargin; // x tick height
float tchy = 0.4*ymargin; // y tick height
float tchz = 0.4*zmargin; // z tick height

//--- Produce tick labels:

ofstream file1("xyzunit");

file1<< setiosflags(ios::fixed | ios::showpoint);

const int ndig = 6;
const int nprc = 3;

for (int i=0; i<=ntcx; i++)
{
float xprint = xmin + i*ticx;
file1 << setprecision(nprc) << setw(ndig) << xprint << endl;
}
for (int i=0; i<=ntcy; i++)
{
float yprint = ymin + i*ticy;
file1 << setprecision(nprc) << setw(ndig) << yprint << endl;
}
for (int i=0; i<=ntcz; i++)
{
float zprint = zmin + i*ticz;
file1 << setprecision(nprc) << setw(ndig) << zprint << endl;
}
file1.close();

//--- Read the tick labels

ifstream file2("xyzunit");
char xunit[ndig];
char yunit[ndig];
char zunit[ndig];

float csizex=0.5*xmargin;
float csizey=0.5*ymargin;
Free download pdf