int x=0;
float h=0;
int []u=new int[20];
int []v= {
-5, -7, 9, 11
};
int []w=new int[5];
int y=0;
void setup() {
background(255, 200, 100);
size(400, 400);
stroke(230, 255, 255);// colour of point
line(0, 200, 400, 200);//axis line
line(200, 0, 200, 400);//axis line
noLoop();// removing the loop
}
void draw() {
for (float i=-10; i<=12; i+=0.0011)
{
h=(2*i*i*i)+(i*i*3);
pointg(i, h);
}
saveFrame();
}
void pointg(float p, float k)
{
int x1=200; // value of initial x
int y1=200;// inital y
x1+=p*20;// the formula for locating x points
y1-=k*20;// the formula for locating y point
stroke(255, 255, 255);
point(x1, y1);// point
line(x, y, x1, y1);
x=x1;
y=y1;
}
No comments:
Post a Comment