//sketch_3D_Z_Bolt_A 六角穴付きボルト 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_A(8,12,16,30);//六角穴付きボルト (M16x30) } void Bolt_A(float r,float R,float H,float L)//六角穴付きボルト { pushMatrix();translate(0,0,H/2); Z_Bar(R,H);popMatrix();//Zバー 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