// y = x^2, x=[-5, 5]
x = -5;
y = 0;
scale = 6;
for (i = 0; x<=5; i+=2){
y = x * x;
x++;
plot[i] = x * scale;
plot[i + 1] = y * -scale;
}
TWO_PI=Math.PI*2; rotX=65; rotY=20; inc=0;
cosx=Math.cos(rotX);
cosy=Math.cos(rotY);
sinx=Math.sin(rotX);
siny=Math.sin(rotY);
for (a =0; a < TWO_PI; a+=.08) {
for (b =0; b < TWO_PI; b+=.07) {
px=100*Math.cos(a)*Math.cos(b)*Math.cos(b);
py=100*Math.sin(a)*Math.cos(b);
pz=100*Math.sin(b);
zpos=pz*cosx-px*sinx;
xpos=pz*sinx+px*cosx;
ypos=py*cosy-zpos*siny;
zpos=py*siny+zpos*cosy;
depth = 1/((zpos/120)+1);
colors[inc] = inc << 16;
plot[inc++] = (xpos * depth);
plot[inc++] = (ypos * depth);
}
}