//sketch_3D_Z_Bolt_B 六角ボルト 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(4, 4,4); Bolt_B(8,24,10,30);//六角ボルト (M16x30) } void Bolt_B(float r,float B,float H,float L)//六角穴付きボルト { pushMatrix();translate(0,0,H/2); Z_6Bar(B,H);popMatrix();//Z_6角支柱 pushMatrix();translate(0,0,-L/2); Z_Bar(r,L);popMatrix();//Zバー } void Z_Bar(float r,float L)//Zバー { int sides=16;//分割数 int Sn=2;//面数 float Pz[]={-L/2,L/2};//z座標 float R[]={r,r};//回転物半径 int i,j; float angleIncrement = TWO_PI/sides; for(j=0;j