|
12面体を定義しています。
OPTION ANGLE DEGREES
OPTION BASE 0
DIM XX(20),YY(20),ZZ(20)
LET LL=1
FOR TH=0 TO 359 STEP 72
LET XX(K)=LL*COS((TH+18))
LET ZZ(K)=LL*SIN((TH+18))
LET YY(K)=LL*(SQR(5)+3)/4
LET K=K+1
NEXT TH
FOR TH=0 TO 359 STEP 72
LET XX(K)=LL*(SQR(5)+1)/2*COS((TH+18))
LET ZZ(K)=LL*(SQR(5)+1)/2*SIN((TH+18))
LET YY(K)=LL*(SQR(5)-1)/4
LET K=K+1
NEXT TH
FOR TH=0 TO 359 STEP 72
LET XX(K)=LL*(SQR(5)+1)/2*COS((TH+54))
LET ZZ(K)=LL*(SQR(5)+1)/2*SIN((TH+54))
LET YY(K)=-LL*(SQR(5)-1)/4
LET K=K+1
NEXT TH
FOR TH=0 TO 359 STEP 72
LET XX(K)=LL*COS((TH+54))
LET ZZ(K)=LL*SIN((TH+54))
LET YY(K)=-LL*(SQR(5)+3)/4
LET K=K+1
NEXT TH
FILE GETSAVENAME F$,"vtkファイル|*.vtk"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".VTK")=0 THEN LET F$=F$&".vtk"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"# vtk DataFile Version 2.0"
PRINT #1:"dodecahedron"
PRINT #1:"ASCII"
PRINT #1:"DATASET POLYDATA"
PRINT #1:"POINTS";K;"float"
FOR I=0 TO K-1
PRINT #1:XX(I);YY(I);ZZ(I)
NEXT I
PRINT #1:"POLYGONS";36;36*4
FOR I=1 TO 36
READ A,B,C
PRINT#1:3;A;B;C
NEXT I
CLOSE #1
DATA 0,1,2
DATA 0,2,3
DATA 0,3,4
DATA 5,10,6
DATA 5,6,1
DATA 5,1,0
DATA 6,11,7
DATA 6,7,2
DATA 6,2,1
DATA 7,12,8
DATA 7,8,3
DATA 7,3,2
DATA 8,13,9
DATA 8,9,4
DATA 8,4,3
DATA 9,14,5
DATA 9,5,0
DATA 9,0,4
DATA 15,16,11
DATA 15,11,6
DATA 15,6,10
DATA 16,17,12
DATA 16,12,7
DATA 16,7,11
DATA 17,18,13
DATA 17,13,8
DATA 17,8,12
DATA 18,19,14
DATA 18,14,9
DATA 18,9,13
DATA 19,15,10
DATA 19,10,5
DATA 19,5,14
DATA 19,18,17
DATA 19,17,16
DATA 19,16,15
END
|
|