|
20面体を定義しています。
OPTION BASE 0
DIM XX(11),YY(11),ZZ(11)
LET LL=1
LET K=12
LET G=(SQR(5)-1)/2
LET XX(0)=LL
LET YY(0)=LL*G
LET ZZ(0)=0
LET XX(1)=-LL
LET YY(1)=LL*G
LET ZZ(1)=0
LET XX(2)=-LL
LET YY(2)=-LL*G
LET ZZ(2)=0
LET XX(3)=LL
LET YY(3)=-LL*G
LET ZZ(3)=0
LET XX(4)=0
LET YY(4)=LL
LET ZZ(4)=LL*G
LET XX(5)=0
LET YY(5)=-LL
LET ZZ(5)=LL*G
LET XX(6)=0
LET YY(6)=-LL
LET ZZ(6)=-LL*G
LET XX(7)=0
LET YY(7)=LL
LET ZZ(7)=-LL*G
LET XX(8)=LL*G
LET YY(8)=0
LET ZZ(8)=LL
LET XX(9)=LL*G
LET YY(9)=0
LET ZZ(9)=-LL
LET XX(10)=-LL*G
LET YY(10)=0
LET ZZ(10)=-LL
LET XX(11)=-LL*G
LET YY(11)=0
LET ZZ(11)=LL
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:"icosahedron"
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";20;20*4
FOR I=1 TO 20
READ A,B,C
PRINT#1:3;A;B;C
NEXT I
CLOSE #1
DATA 0,8,3
DATA 3,9,0
DATA 1,10,2
DATA 2,11,1
DATA 4,0,7
DATA 7,1,4
DATA 5,2,6
DATA 6,3,5
DATA 8,4,11
DATA 11,5,8
DATA 9,6,10
DATA 10,7,9
DATA 0,4,8
DATA 0,9,7
DATA 1,11,4
DATA 1,7,10
DATA 2,5,11
DATA 2,10,6
DATA 3,8,5
DATA 3,6,9
END
|
|