Programming and Graphics

(Kiana) #1

244 Introduction to C++ Programming and Graphics


//--- Zoom if middle button is pressed:

if(click==2)
{
zoom = zoominit*(xaddr+1.0);
color(bgc);
clear();
drawplot3d ();
}

goto again;

//--- Done

return;
}

Code plot3d


The following main program contained in the fileplot3d.ccdefines and
plots data points based on the two functions we have constructed:


/*------------------------
plot3d
interactive 3-D plot
-------------------------*/

#include<iostream>
#include<cmath>
#include "VOGLE/voglec++.h"
#include "drawplot3d.h"
#include "plot3dtrans.h"

using namespace std;

//--- Global variables:

const float pi=3.1415926;

float xmin=0, xmax=1;
float ymin=0, ymax=1;
float zmin=0, zmax=1;
float vx=0.1, vy=0.1, vz=0.5*zmax;
float twist=0;
float angx=0; // rotation angle
float angy=0; // rotation angle
float angz=0; // rotation angle
Free download pdf