! utf-8
! 譁�ｭ励さ繝ｼ繝峨�utf-8
! 閾ｪ逕ｱ蠖｢蠑上�fortran縺ｧ譖ｸ縺�※縺�∪縺吶�
! g77縺ｧ繧ｳ繝ｳ繝代う繝ｫ縺吶ｋ蝣ｴ蜷医�縲�
!g77 -ffree-form -o smv smv.f
! 縺ｮ繧医≧縺ｫ繧ｳ繝ｳ繝代う繝ｫ縺励※縺上□縺輔＞縲�
! gfortran 縺ｧ繧ｳ繝ｳ繝代う繝ｫ縺吶ｋ蝣ｴ蜷医�譁�ｭ励さ繝ｼ繝峨ｒutf-8縺ｫ縺励※縺上□縺輔＞縲�
implicit real*4 (a-h, o-z)
dimension x(3000000),y(3000000),z(3000000),&
& xu(3000000),yu(3000000),zu(3000000),&
&         mesh(1000000,6),narabi(10000,10000),&
&         mesh2(1000000,6)
character mozi*20,mozi0*20
!!!!!!!!!!!!
!!!!!!!!!!!!
pi=2.d0*asin(1.d0)
syu=18.d-2
atusa=9.d-3
call zyabara(syu)
r=syu/2.d0/pi-atusa
syu=2.d0*pi*r
call zyabara(syu)
close(8)
!!!!!!!!!!!!
!!!!!!!!!!!!
!!!!!!!!!!!!
open(9,file='zya.obj') !yousosuu.f縺ｧ謨ｰ縺医◆隕∫ｴ�謨ｰ繝輔ぃ繧､繝ｫ
read(9,*) mozi0 !1陦檎岼縺ｮ譁�ｭ励ｒ隱ｭ縺ｿ霎ｼ繧
read(9,*) nset !遽轤ｹ謨ｰ縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
do i=0,nset-1
 read(9,*) x(i),y(i),z(i) !蜷�ｯ轤ｹ縺ｮ蠎ｧ讓吝､縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
end do
!
open(7,file='yousosuu.txt') !yousosuu.f縺ｧ謨ｰ縺医◆隕∫ｴ�謨ｰ繝輔ぃ繧､繝ｫ
read(7,*) nyou !隕∫ｴ�謨ｰ縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
do i=1,nyou
!蜷�ｦ∫ｴ�縺ｮ鬆らせ謨ｰ?縲∝推鬆らせ縺ｮ遽轤ｹ逡ｪ蜿ｷ縲√き繝ｩ繝ｼ繧ｳ繝ｼ繝�?縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
read(9,*) kazu,mesh(i,1),mesh(i,2),mesh(i,3),mozi
end do
!
do i=0,nset
do j=0,nset
!髫｣繧雁粋縺�ｯ轤ｹi,j縺ｮ荳ｭ髢薙�遽轤ｹ逡ｪ蜿ｷ縺ｮ蛻晄悄蛟､繧偵☆縺ｹ縺ｦ-1縺ｫ縺励※縺翫￥
narabi(i,j)=-1
end do
end do
!
!!!!!!!!!!!!
read(9,*) mozi0 !1陦檎岼縺ｮ譁�ｭ励ｒ隱ｭ縺ｿ霎ｼ繧
read(9,*) mozi0 !1陦檎岼縺ｮ譁�ｭ励ｒ隱ｭ縺ｿ霎ｼ繧
read(9,*) nset !遽轤ｹ謨ｰ縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
do i=0,nset-1
 read(9,*) xu(i),yu(i),zu(i) !蜷�ｯ轤ｹ縺ｮ蠎ｧ讓吝､縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
end do
!
do i=1,nyou
!蜷�ｦ∫ｴ�縺ｮ鬆らせ謨ｰ?縲∝推鬆らせ縺ｮ遽轤ｹ逡ｪ蜿ｷ縲√き繝ｩ繝ｼ繧ｳ繝ｼ繝�?縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
read(9,*) kazu,mesh2(i,1),mesh2(i,2),mesh2(i,3),mozi
end do
!
do i=0,nset
do j=0,nset
!髫｣繧雁粋縺�ｯ轤ｹi,j縺ｮ荳ｭ髢薙�遽轤ｹ逡ｪ蜿ｷ縺ｮ蛻晄悄蛟､繧偵☆縺ｹ縺ｦ-1縺ｫ縺励※縺翫￥
narabi(i,j)=-1
end do
end do
!
!
!
print*,'solid'
do i=1,nyou
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=x(mesh(i,2)+1); y2=y(mesh(i,2)+1); z2=z(mesh(i,2)+1)
x3=x(mesh(i,3)+1); y3=y(mesh(i,3)+1); z3=z(mesh(i,3)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,2)+1); y1=y(mesh(i,2)+1); z1=z(mesh(i,2)+1)
x2=x(mesh(i,3)+1); y2=y(mesh(i,3)+1); z2=z(mesh(i,3)+1)
x3=xu(mesh(i,3)+1); y3=yu(mesh(i,3)+1); z3=zu(mesh(i,3)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,3)+1); y1=y(mesh(i,3)+1); z1=z(mesh(i,3)+1)
x2=xu(mesh(i,3)+1); y2=yu(mesh(i,3)+1); z2=zu(mesh(i,3)+1)
x3=x(mesh(i,2)+1); y3=y(mesh(i,2)+1); z3=z(mesh(i,2)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=x(mesh(i,2)+1); y2=y(mesh(i,2)+1); z2=z(mesh(i,2)+1)
x3=xu(mesh(i,3)+1); y3=yu(mesh(i,3)+1); z3=zu(mesh(i,3)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=x(mesh(i,2)+1); y2=y(mesh(i,2)+1); z2=z(mesh(i,2)+1)
x3=xu(mesh(i,3)+1); y3=yu(mesh(i,3)+1); z3=zu(mesh(i,3)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,2)+1); y1=y(mesh(i,2)+1); z1=z(mesh(i,2)+1)
x2=xu(mesh(i,3)+1); y2=yu(mesh(i,3)+1); z2=zu(mesh(i,3)+1)
x3=xu(mesh(i,2)+1); y3=yu(mesh(i,2)+1); z3=zu(mesh(i,2)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=xu(mesh(i,3)+1); y1=yu(mesh(i,3)+1); z1=zu(mesh(i,3)+1)
x2=xu(mesh(i,2)+1); y2=yu(mesh(i,2)+1); z2=zu(mesh(i,2)+1)
x3=x(mesh(i,1)+1); y3=y(mesh(i,1)+1); z3=z(mesh(i,1)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=x(mesh(i,2)+1); y2=y(mesh(i,2)+1); z2=z(mesh(i,2)+1)
x3=xu(mesh(i,2)+1); y3=yu(mesh(i,2)+1); z3=zu(mesh(i,2)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=xu(mesh(i,2)+1); y2=yu(mesh(i,2)+1); z2=zu(mesh(i,2)+1)
x3=xu(mesh(i,3)+1); y3=yu(mesh(i,3)+1); z3=zu(mesh(i,3)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=xu(mesh(i,2)+1); y1=yu(mesh(i,2)+1); z1=zu(mesh(i,2)+1)
x2=xu(mesh(i,3)+1); y2=yu(mesh(i,3)+1); z2=zu(mesh(i,3)+1)
x3=xu(mesh(i,1)+1); y3=yu(mesh(i,1)+1); z3=zu(mesh(i,1)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=xu(mesh(i,3)+1); y1=yu(mesh(i,3)+1); z1=zu(mesh(i,3)+1)
x2=xu(mesh(i,1)+1); y2=yu(mesh(i,1)+1); z2=zu(mesh(i,1)+1)
x3=x(mesh(i,1)+1); y3=y(mesh(i,1)+1); z3=z(mesh(i,1)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
x1=x(mesh(i,1)+1); y1=y(mesh(i,1)+1); z1=z(mesh(i,1)+1)
x2=xu(mesh(i,2)+1); y2=yu(mesh(i,2)+1); z2=zu(mesh(i,2)+1)
x3=xu(mesh(i,1)+1); y3=yu(mesh(i,1)+1); z3=zu(mesh(i,1)+1)
call housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
print*,'facet normal',xn,yn,zn
print*,'outer loop'
print*,'vertex',x1,y1,z1
print*,'vertex',x2,y2,z2
print*,'vertex',x3,y3,z3
print*,'endloop'
print*,'endfacet'
!!!!!!!!!!!!!!!!!!!!!!
print*, 'endlsolid'
end do
!
end
!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!
subroutine zyabara(syu)
implicit real*4 (a-h, o-z)
!
pi=2.d0*asin(1.d0)
r=syu/2.d0/pi !蜀�捉縺ｮ蜊雁ｾ�
zure=0.5 !鬮倥＆譁ｹ蜷代�縺壹ｌ
m=6!蜻ｨ譁ｹ蜷大�蜑ｲ謨ｰ
n=10!鬮倥＆譁ｹ蜷大�蜑ｲ謨ｰ
h=1.2d-1 !鬮倥＆(謚倥ｊ逡ｳ縺ｾ縺ｪ縺�憾諷九〒縺ｮ鬮倥＆)
dh=h*0.4/n !謚倥ｊ逡ｳ繧薙□譎ゅ�蜿ｰ蠖｢1谿ｵ縺ｶ繧捺万霎ｺ縺ｮ髟ｷ縺�
psi=asin(dh/(h/n))!繝繧､繝､荳芽ｧ偵�隗貞ｺｦ
!!!
orih=h/n*cos(psi)!謚倥ｊ逡ｳ縺ｿ蜀�ｭ偵ｒ荳翫°繧芽ｦ九◆縺ｨ縺阪�蟷�
!orih2=sqrt((h/n)**2-(dh)**2)
nset=6*m+3*m*(2*n-1) !遽轤ｹ謨ｰ
nyou=12*m*n !隕∫ｴ�謨ｰ
       open(7,file='yousosuu.txt')
       write(7,*) nyou
       write(7,*) 2*m,2*n
       close(7)
th=2.d0*pi/m !繝繧､繝､1縺､縺ｶ繧薙�荳ｭ蠢�ｧ�
ph=(pi-th)/2. !螟夊ｧ貞ｽ｢縺ｮ1霎ｺ縺ｨ荳ｭ蠢�ｒ邨舌�荳芽ｧ貞ｽ｢縺ｮ蠎戊ｧ�
oh=pi/2.-th !螟夊ｧ貞ｽ｢縺ｮ1霎ｺ縺ｨ荳ｭ蠢�ｒ邨舌�荳芽ｧ貞ｽ｢縺ｮ蠎戊ｧ�
!ccccccccccccccccccccc
sita=orih/cos(oh)*2
ue=orih*tan(oh)*2
b=((ue-sita)/2)+(syu/m)
!ensyu=((b+sita)*m/2.)+((b-ue)*m/2.)
hank=b/(2*sin(th/2))
!cccccccccccccccccccccc
open(8,file='zya.obj')
write(8,'("3DG1")')
write(8,*) nset
        x1=hank*cos(ph)+orih/sin(th)
        y1=hank*sin(ph)
        x2=hank*cos(ph)-orih/tan(th)
        y2=hank*sin(ph)+orih
uegawa=1. !蜷後§谿ｵ縺ｧ荳雁�繧貞髄縺�※縺�ｋ縺倶ｸ句�繧貞髄縺�※縺�ｋ縺九ｒ豁｣雋�縺ｧ蛹ｺ蛻･
do i=0,m-1 !蜀�捉譁ｹ蜷代↓1蝗槭ｊ縺壹▽
!xyz蠎ｧ讓吶ｒ蜃ｺ蜉�
!荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ繧貞�縺励※縲�
!th縺壹▽蠎ｧ讓吝､画鋤縺ｧ蝗櫁ｻ｢縺輔○繧�
thi=th*real(i)
th0=th*real(i-1)
th1=th*real(i+1)
j=1 !1谿ｵ繧∝燕蜊�
if(uegawa>0) then !荳雁�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ荳企�らせ縺�縺想蠎ｧ讓吶ｒdh荳九￡繧�
       write(8,*) sin(thi)*y1, cos(thi)*y1, (j-1)*dh
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) (sin(thi)*y1+x1d)/2,(cos(thi)*y1+y1d)/2,(j-1)*dh
       write(8,*) (sin(thi)*y1+x3d)/2,(cos(thi)*y1+y3d)/2,(2*j-1)*dh/2
       write(8,*) (x1d+x3d)/2,(y1d+y3d)/2,(2*j-1)*dh/2
       write(8,*) (x1d+(sin(th1)*y1))/2,(y1d+(cos(th1)*y1))/2,(2*j-1)*dh/2
       write(8,*) x1d,y1d,(j-1)*dh
else !荳句�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ蟾ｦ蜿ｳ荳矩�らせ繧壇h荳九￡繧九ゆｸ企�らせ縺ｯ荳九￡縺ｪ縺��
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) ((cos(th0)*x1+sin(th0)*y1)+x3d)/2,&
&                ((-sin(th0)*x1+cos(th0)*y1)+y3d)/2, (j-1)*dh
       write(8,*) x3d,y3d,(j-1)*dh
       write(8,*) (sin(thi)*y1+x3d)/2,(cos(thi)*y1+y3d)/2,(2*j-1)*dh/2
       write(8,*) (x1d+x3d)/2,(y1d+y3d)/2,(2*j-1)*dh/2
       write(8,*) (x1d+sin(th1)*y1)/2,(y1d+cos(th1)*y1)/2,(2*j-1)*dh/2
       write(8,*) (x3d+sin(th1)*y1)/2,(y3d+cos(th1)*y1)/2,(j-1)*dh
endif
uegawa=uegawa*(-1.)
end do
!
! 1谿ｵ繧∝ｾ悟濠
j=1
thi=th*real(0)
thm=th*real(m-1)
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*)  (x3d+(cos(thm)*x1+sin(thm)*y1))/2,&
&                  (y3d+(-sin(thm)*x1+cos(thm)*y1))/2, j*dh
do i=1,m-1,2 !蜀�捉譁ｹ蜷代↓1蝗槭ｊ縺壹▽縺�縺代←1谿ｵ繧√→遽轤ｹ繧貞�譛峨＠縺ｪ縺��縺ｯ縲�
!荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縺ｨ縺昴ｌ縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ蜿ｳ荳企�らせ縲�
!縺薙�3鬆らせ繧稚h縺壹▽m/2蝗槫屓霆｢縺輔○繧後�縺�＞繧薙〒繧ｹ繝�ャ繝励′2縺ｫ縺ｪ縺｣縺ｦ繧九�
thi=th*real(i)
th0=th*real(i-1) !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ鬆らせ逕ｨ
th1=th*real(i+1) !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ鬆らせ逕ｨ
 if(i/=m-1) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
     write(8,*) x2d,y2d,j*dh
     write(8,*) (x2d+(sin(thi)*y1))/2,(y2d+(cos(thi)*y1))/2,j*dh
     write(8,*) sin(thi)*y1,cos(thi)*y1,j*dh
     write(8,*) ((sin(thi)*y1)+x1d)/2,((cos(thi)*y1)+y1d)/2,j*dh
     write(8,*) x1d,y1d,j*dh
     write(8,*) (x1d+x4d)/2,(y1d+y4d)/2,j*dh
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
     write(8,*) x2d,y2d,j*dh
     write(8,*) (x2d+(sin(thi)*y1))/2,(y2d+(cos(thi)*y1))/2,j*dh
     write(8,*) sin(thi)*y1,cos(thi)*y1,j*dh
     write(8,*) (sin(thi)*y1+x1d)/2,(cos(thi)*y1+y1d)/2,j*dh
     write(8,*) x1d,y1d,j*dh
end if
end do
!
dansuu=1.
do j=1,n-1
!
!
! 2谿ｵ繧∝燕蜊�
uegawa=1. !蜷後§谿ｵ縺ｧ荳雁�繧貞髄縺�※縺�ｋ縺倶ｸ句�繧貞髄縺�※縺�ｋ縺九ｒ豁｣雋�縺ｧ蛹ｺ蛻･
do i=0,m-1 !蜀�捉譁ｹ蜷代↓1蝗槭ｊ縺壹▽
thi=th*real(i)
th0=th*real(i-1)
th1=th*real(i+1)
if(uegawa>0) then !荳雁�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ荳企�らせ縺�縺想蠎ｧ讓吶ｒdh荳九￡繧�
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) (sin(thi)*y1+x3d)/2,(cos(thi)*y1+y3d)/2,(2*j+1)*dh/2.
       write(8,*) (x1d+x3d)/2,(y1d+y3d)/2,(2*j+1)*dh/2.
       write(8,*) (x1d+(sin(th1)*y1))/2,(y1d+(cos(th1)*y1))/2,(2*j+1)*dh/2.
else !荳句�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ蟾ｦ蜿ｳ荳矩�らせ繧壇h荳九￡繧九ゆｸ企�らせ縺ｯ荳九￡縺ｪ縺��
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) (sin(thi)*y1+x3d)/2,(cos(thi)*y1+y3d)/2,(2*j+1)*dh/2.
       write(8,*) (x1d+x3d)/2,(y1d+y3d)/2,(2*j+1)*dh/2.
       write(8,*) (x1d+sin(th1)*y1)/2,(y1d+cos(th1)*y1)/2,(2*j+1)*dh/2.
endif
uegawa=uegawa*(-1.)
end do
!
!
!
if(dansuu>0) then
!
!
! 2谿ｵ繧∝ｾ悟濠
uegawa=1. !蜷後§谿ｵ縺ｧ荳雁�繧貞髄縺�※縺�ｋ縺倶ｸ句�繧貞髄縺�※縺�ｋ縺九ｒ豁｣雋�縺ｧ蛹ｺ蛻･
do i=0,m-1 !蜀�捉譁ｹ蜷代↓1蝗槭ｊ縺壹▽
thi=th*real(i)
th0=th*real(i-1)
th1=th*real(i+1)
if(uegawa>0) then !荳雁�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ荳企�らせ縺�縺想蠎ｧ讓吶ｒdh荳九￡繧�
       write(8,*) sin(thi)*y1, cos(thi)*y1, (j+1)*dh
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) (sin(thi)*y1+x1d)/2,(cos(thi)*y1+y1d)/2,(j+1)*dh
       write(8,*) x1d,y1d,(j+1)*dh
else !荳句�繧貞髄縺�※縺�ｋ蝣ｴ蜷医∝承荳芽ｧ貞ｽ｢縺ｮ蟾ｦ蜿ｳ荳矩�らせ繧壇h荳九￡繧九ゆｸ企�らせ縺ｯ荳九￡縺ｪ縺��
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) ((cos(th0)*x1+sin(th0)*y1)+x3d)/2,&
&                ((-sin(th0)*x1+cos(th0)*y1)+y3d)/2,(j+1)*dh
       write(8,*) x3d,y3d,(j+1)*dh
       write(8,*) (x3d+sin(th1)*y1)/2,(y3d+cos(th1)*y1)/2,(j+1)*dh
endif
uegawa=uegawa*(-1.)
end do
!
else
!
thi=th*real(0)
thm=th*real(m-1)
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
       write(8,*) (x3d+(cos(thm)*x1+sin(thm)*y1))/2,&
&               (y3d+(-sin(thm)*x1+cos(thm)*y1))/2, (j+1)*dh
do i=1,m-1,2 !蜀�捉譁ｹ蜷代↓1蝗槭ｊ縺壹▽縺�縺代←1谿ｵ繧√→遽轤ｹ繧貞�譛峨＠縺ｪ縺��縺ｯ縲�
!荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縺ｨ縺昴ｌ縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ蜿ｳ荳企�らせ縲�
!縺薙�3鬆らせ繧稚h縺壹▽m/2蝗槫屓霆｢縺輔○繧後�縺�＞繧薙〒繧ｹ繝�ャ繝励′2縺ｫ縺ｪ縺｣縺ｦ繧九�
thi=th*real(i)
th0=th*real(i-1) !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ鬆らせ逕ｨ
th1=th*real(i+1) !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺九ｉth蝗櫁ｻ｢縺励◆荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ鬆らせ逕ｨ
 if(i/=m-1) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
     write(8,*) x2d,y2d,(j+1)*dh
     write(8,*) (x2d+(sin(thi)*y1))/2,(y2d+(cos(thi)*y1))/2,(j+1)*dh
     write(8,*) sin(thi)*y1,cos(thi)*y1,(j+1)*dh
     write(8,*) ((sin(thi)*y1)+x1d)/2,((cos(thi)*y1)+y1d)/2,(j+1)*dh
     write(8,*) x1d,y1d,(j+1)*dh
     write(8,*) (x1d+x4d)/2,(y1d+y4d)/2,(j+1)*dh
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
       call zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
     write(8,*) x2d,y2d,(j+1)*dh
     write(8,*) (x2d+(sin(thi)*y1))/2,(y2d+(cos(thi)*y1))/2,(j+1)*dh
     write(8,*) sin(thi)*y1,cos(thi)*y1,(j+1)*dh
     write(8,*) (sin(thi)*y1+x1d)/2,(cos(thi)*y1+y1d)/2,(j+1)*dh
     write(8,*) x1d,y1d,(j+1)*dh
end if
end do
!
end if
dansuu=dansuu*(-1.)
end do
!
!
!
!1蜻ｨ縺壹▽荳雁�荳牙ｽ｢縺ｨ荳句�荳芽ｧ貞ｽ｢縺ｮ鬆らせ縺ｮ遽轤ｹ繧貞､悶°繧芽ｦ九※蟾ｦ蝗槭ｊ縺ｫ蜃ｺ蜉�
!1谿ｵ繧∝燕蜊�
do i=0,2*m-2,2 !蜻ｨ譁ｹ蜷代↓
 if(i/=2*m-2) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,i*3,i*3+1,i*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+2,i*3+1,i*3+3,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+1,i*3+5,i*3+3,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+3,i*3+5,i*3+4,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,i*3+5,i*3+6,i*3+4,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,i*3+4,i*3+6,i*3+8,' ','0xcccccc'
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,i*3,i*3+1,i*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+2,i*3+1,i*3+3,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+1,i*3+5,i*3+3,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+3,i*3+5,i*3+4,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,i*3+5,0,i*3+4,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,i*3+4,0,2,' ','0xcccccc'
 end if
end do
!
!1谿ｵ繧∝ｾ悟濠
do i=0,2*m-2,2 !蜻ｨ譁ｹ蜷代↓
 i2=i/2
 if(i/=2*m-2) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,i*3+2,i*3+3,m*6+i2*3+1,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,m*6+i2*3+1,i*3+3,m*6+i2*3+2,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,i*3+3,i*3+4,m*6+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,m*6+i2*3+2,i*3+4,m*6+i2*3+3,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+4,i*3+8,m*6+i2*3+3,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,m*6+i2*3+3,i*3+8,m*6+i2*3+4,' ','0xaaaccc'
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,i*3+2,i*3+3,m*6+i2*3+1,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,m*6+i2*3+1,i*3+3,m*6+i2*3+2,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,i*3+3,i*3+4,m*6+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,m*6+i2*3+2,i*3+4,m*6,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,i*3+4,2,m*6,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,m*6,2,m*6+1,' ','0xaaaccc'
 end if
end do
!
!
dansuu=1.
do j=0,n-2
!
!
!2谿ｵ繧∝燕蜊�
do i=0,2*m-2,2 !蜻ｨ譁ｹ蜷代↓
 i2=i/2
 nh1=m*6*j
 if(i/=2*m-2) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*6+i2*3+1,nh1+m*6+i2*3+2,nh1+m*9+i2*3+1,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*9+i2*3+1,nh1+m*6+i2*3+2,nh1+m*9+i2*3+2,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh1+m*6+i2*3+2,nh1+m*6+i2*3+3,nh1+m*9+i2*3+2,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh1+m*9+i2*3+2,nh1+m*6+i2*3+3,nh1+m*9+i2*3+3,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh1+m*6+i2*3+3,nh1+m*6+i2*3+4,nh1+m*9+i2*3+3,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*9+i2*3+3,nh1+m*6+i2*3+4,nh1+m*9+i2*3+4,' ','0xaaaccc'
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*6+i2*3+1,nh1+m*6+i2*3+2,nh1+m*9+i2*3+1,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*9+i2*3+1,nh1+m*6+i2*3+2,nh1+m*9+i2*3+2,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh1+m*6+i2*3+2,nh1+m*6,nh1+m*9+i2*3+2,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh1+m*9+i2*3+2,nh1+m*6,nh1+m*9,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh1+m*6,nh1+m*6+1,nh1+m*9,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh1+m*9,nh1+m*6+1,nh1+m*9+1,' ','0xaaaccc'
 end if
end do
!
 if(dansuu>0) then
!
!2谿ｵ繧∝ｾ悟濠
do i=0,2*m-2,2 !蜻ｨ譁ｹ蜷代↓
 i2=i/2
 nh2=12*m*j/2
 if(i/=2*m-2) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh2+m*9+i2*3+1,nh2+m*9+i2*3+2,nh2+m*12+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*12+i2*3+2,nh2+m*9+i2*3+2,nh2+m*12+i2*3+3,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*9+i2*3+2,nh2+m*9+i2*3+3,nh2+m*12+i2*3+3,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*12+i2*3+3,nh2+m*9+i2*3+3,nh2+m*12+i2*3+4,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh2+m*9+i2*3+3,nh2+m*9+i2*3+4,nh2+m*12+i2*3+4,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh2+m*12+i2*3+4,nh2+m*9+i2*3+4,nh2+m*12+i2*3+5,' ','0xcccccc'
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh2+m*9+i2*3+1,nh2+m*9+i2*3+2,nh2+m*12+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*12+i2*3+2,nh2+m*9+i2*3+2,nh2+m*12,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*9+i2*3+2,nh2+m*6+i2*3+3,nh2+m*12,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*12,nh2+m*6+i2*3+3,nh2+m*12+1,' ','0xaaaccc'
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh2+m*6+i2*3+3,nh2+m*6+i2*3+4,nh2+m*12+1,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh2+m*12+1,nh2+m*6+i2*3+4,nh2+m*12+2,' ','0xcccccc'
 end if
end do
!
else
!
do i=0,2*m-2,2 !蜻ｨ譁ｹ蜷代↓
 i2=i/2
 nh2=12*m+(m*12*(j-1)/2)
 if(i/=2*m-2) then !蜻ｨ縺ｮ髢句ｧ九°繧我ｸ縺､蜑阪∪縺ｧ
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh2+m*3+i2*3,nh2+m*3+i2*3+1,nh2+m*6+i2*3+1,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh2+m*6+i2*3+1,nh2+m*3+i2*3+1,nh2+m*6+i2*3+2,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh2+m*3+i2*3+1,nh2+m*3+i2*3+2,nh2+m*6+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*6+i2*3+2,nh2+m*3+i2*3+2,nh2+m*6+i2*3+3,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*3+i2*3+2,nh2+m*3+i2*3+3,nh2+m*6+i2*3+3,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*6+i2*3+3,nh2+m*3+i2*3+3,nh2+m*6+i2*3+4,' ','0xaaaccc'
 else !蜻ｨ縺ｮ荳逡ｪ譛蠕後�縲�幕蟋狗せ縺ｮ鬆らせ縺ｨ縺上▲縺､縺上ｈ縺�↓
  !荳雁�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ�
  write(8,*) 3,nh2+m*3+i2*3,nh2+m*3+i2*3+1,nh2+m*6+i2*3+1,' ','0xcccccc'
  !荳雁�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∽ｸ九∝承荳企�らせ
  write(8,*) 3,nh2+m*6+i2*3+1,nh2+m*3+i2*3+1,nh2+m*6+i2*3+2,' ','0xcccccc'
  !荳雁�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∝承荳矩�らせ縲∽ｸ企�らせ
  write(8,*) 3,nh2+m*3+i2*3+1,nh2+m*3+i2*3+2,nh2+m*6+i2*3+2,' ','0xcccccc'
  !荳句�蟾ｦ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ企�らせ縲∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*6+i2*3+2,nh2+m*3+i2*3+2,nh2+m*6,' ','0xaaaccc'
  !荳句�荳ｭ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳企�らせ縲∝承荳企�らせ縲∽ｸ�(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*3+i2*3+2,nh2+m*3,nh2+m*6,' ','0xaaaccc'
  !荳句�蜿ｳ荳芽ｧ貞ｽ｢縺ｮ蟾ｦ荳矩�らせ縲∽ｸ翫∝承荳矩�らせ(荳九°繧芽ｦ九※蟾ｦ蝗槭ｊ)
  write(8,*) 3,nh2+m*6,nh2+m*3,nh2+m*6+1,' ','0xaaaccc'
 end if
end do
!
 end if
dansuu=dansuu*(-1.)
end do
write(8,'("#")') !daiya.obj繝輔ぃ繧､繝ｫ縺九ｉ隕∫ｴ�謨ｰ繧定ｪｭ縺ｿ蜿悶ｋ縺ｨ縺咲畑
!
return
end
!
!
subroutine zahen(thi,th0,th1,orih,x1,y1,x2,y2,x1d,y1d,x2d,y2d,x3d,y3d,x4d,y4d)
implicit real*4 (a-h, o-z)
x1d=cos(thi)*x1+sin(thi)*y1
y1d=-sin(thi)*x1+cos(thi)*y1
x2d=cos(th0)*x2+sin(th0)*y2
y2d=-sin(th0)*x2+cos(th0)*y2
x3d=cos(thi)*x2+sin(thi)*y2
y3d=-sin(thi)*x2+cos(thi)*y2
x4d=cos(th1)*x2+sin(th1)*y2
y4d=-sin(th1)*x2+cos(th1)*y2
return
end
!
subroutine housen(x1,y1,z1,x2,y2,z2,x3,y3,z3,xn,yn,zn)
implicit real*4 (a-h, o-z)
ax=x2-x1
ay=y2-y1
az=z2-z1
bx=x3-x1
by=y3-y1
bz=z3-z1
ab=sqrt(ax**2+ay**2+az**2)*sqrt(bx**2+by**2+bz**2)
anaib=ax*bx+ay*by+az*bz
costh=anaib/ab
sinth=sqrt(1.d0-costh**2)
ookisa=ab*sinth
xn=ax*bz-az*by
yn=az*bx-ax*bz
zn=ax*by-ay*bx
xn=xn/ookisa
yn=yn/ookisa
zn=zn/ookisa
return
end