A simple parametric curve in cartesian coordinates, using the new graph object : PHParametricCurve. Here is also present a PHLineWithCartesianEquation and a PHFunctionGraph (asymptotes), as well as a PHAxisSystem... The code follows the screenshot.

Image 4

#import "AppController.h"

int param(double t, double *x, double *y)
{
if (t==0) return 1;

*x = t*t+
2/t;
*y = t*t+
1/(t*t);
return 0;
}

double parabole(double x, int *flag)
{
*flag =
0;
return x*x/4;
}

@implementation AppController

(some skipped methods here, see the first three examples for more detail)

-(
void)awakeFromNib
{
xaxis = [[PHxAxis alloc] init];
[
xaxis setMinimum:-2 maximum:2];

yaxis = [[PHyAxis alloc] init];
[yaxis
setMinimum:-1.6 maximum:1.6];

[
graphView addPHxAxis:xaxis];
[
graphView addPHyAxis:yaxis];
[
graphView setMouseEventsMode:PHCompositeZoomAndDrag];

PHParametricCurve* curve = [[PHParametricCurve alloc]
initWithXAxis:xaxis yAxis:yaxis function:param
tmin:-3.1416 tmax:3.1416 ];
[curve
setColor:[NSColor redColor]];
[curve
setTmin:-5 tmax:5];

PHFunctionGraph* paraboleAsymptote = [[PHFunctionGraph alloc]
initWithXAxis:xaxis yAxis:yaxis function:parabole];

[paraboleAsymptote
setColor:[NSColor blackColor]];
[paraboleAsymptote
setWidth:0.5];

PHLineWithCartesianEquation* line = [[PHLineWithCartesianEquation alloc]
initWithXAxis:xaxis yAxis:yaxis a:1 b:-1 c:0];
[line
setColor:[NSColor greenColor]];
[line
setWidth:0.5];

PHAxisSystem* systemAxis = [[PHAxisSystem alloc]
initWithXAxis:xaxis yAxis:yaxis];

[graphView
addPHGraphObject:curve];
[graphView
addPHGraphObject:paraboleAsymptote];
[graphView
addPHGraphObject:line];
[graphView
addPHGraphObject:systemAxis];
[graphView
setDelegate:self];

}
@end