home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RISC DISC 3
/
RISC_DISC_3.iso
/
resources
/
etexts
/
gems
/
gemsv
/
ch5_4
/
poly.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-04
|
744b
|
34 lines
/*************************************************
* POLY.H
* Andreas Leipelt, "Ray Tracing a Swept Sphere"
* from "Graphics Gems", Academic Press
*
*/
#ifndef POLY_CLASS
#define POLY_CLASS
#define MAX_DEGREE 10
#define polyeps 1E-10 // tolerance for polynomial coefficients
class polynomial {
public:
int deg;
double coef[MAX_DEGREE+1];
polynomial();
double eval(double);
int roots_between(double,double,double*);
double min(double,double);
double max(double,double);
polynomial derivative();
};
polynomial operator+(polynomial&, polynomial&);
polynomial operator-(polynomial&, polynomial&);
polynomial operator*(polynomial&, polynomial&);
polynomial operator*(double, polynomial&);
#endif