//sketch_3D_Z_Nut 六角ナット 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.1); fill(255, 255, 255); scale(5, 5,5); Z_Nut(24,13,8);//六角ナット } void Z_Nut(float B,float T,float R)//六角ナット { int Pn=7;//ポイント数 float[] X=new float[Pn]; float[] Y=new float[Pn]; int i; float r=B/(2*cos(30*PI/180)); for(i=0;i= 0; i--) { vertex(X[i],Y[i]); } }