An object that draws the graph of a function, calculating
the values on demand (so there is no loss of precision when
zooming in for example.)
Relevant part of the header :
-(id)initWithXAxis:(PHxAxis
*)xaxis
yAxis:(PHyAxis
*)yaxis
function:(double
(*)(double,int*))newFunction;
-(void)setFunction:(double
(*)(double,int*))newFunction;
-(void)setWidth:(float)newWidth;
An example of a correct function in C to be given as a
reference to PHGraphFunc could be (from example 3) :
double
function(double
x,
int *flag)
{
if (x!=0)
{
*flag=0;
return x*x*sin(1/x);
}
else
{
*flag=1;
return
0;
}
}
Note that when this function is called, flag is initialized
to 0, so if there is no control to do as to the domain of
the function, just ignore the flag.