//sketch_3D_Z_Parasol void setup() { size(400, 400, P3D); } void draw() { background(255, 255, 255); lights(); ortho(-width/2, width/2, -height/2, height/2); // Same as ortho() translate(width / 2, height / 2); rotateY(map(mouseX, 0, width, -PI/1, PI/1)); rotateX(map(mouseY, 0, height, PI/1, -PI/1)); //noStroke(); strokeWeight(0.5); fill(255, 255, 255); scale(2,2,2); //void Z_Parasol(int Sn,float R,float A)//パラソル面 Z_Parasol(4,72.5,60);//パラソル面 } void Z_Parasol(int Sn,float R,float A)//パラソル面 { int Pn=17;//ポイント数 float[][] X=new float[Sn+1][Pn]; float[][] Y=new float[Sn+1][Pn]; float[] Z=new float[Sn+1]; int i,j; for(j=0;j<=Sn;j++) { float Aj=j*A*PI/(180*(Sn-1)); Z[j]=R*cos(Aj); float Ry=R*sin(Aj); for(i=0;i