|
座標を求め帯状にmeshを生成しています。
OPTION BASE 0
RANDOMIZE
LET N=360 !'分割数
DIM X1(N),Y1(N),Z1(N),X2(N),Y2(N),Z2(N)
LET A=INT(RND*7)+1
DO
LET B=INT(RND*7)+1
LOOP WHILE A=B
LET R=INT(RND*10)+3
FOR I=0 TO N
LET ALPHA=I*2
LET X1(I)=(A+R*SIN(ALPHA/2*PI/180))*COS(ALPHA*PI/180) !'メビウスの帯
LET Y1(I)=(A+R*SIN(ALPHA/2*PI/180))*SIN(ALPHA*PI/180)
LET Z1(I)=A+R*COS(ALPHA/2*PI/180)
LET X2(I)=(B+R*SIN(ALPHA/2*PI/180))*COS(ALPHA*PI/180)
LET Y2(I)=(B+R*SIN(ALPHA/2*PI/180))*SIN(ALPHA*PI/180)
LET Z2(I)=B+R*COS(ALPHA/2*PI/180)
NEXT I
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:"moebius"
PRINT #1:"ASCII"
PRINT #1:"DATASET POLYDATA"
PRINT #1:"POINTS";2*(N+1);"float"
FOR I=0 TO N
PRINT #1:X1(I);Y1(I);Z1(I)
PRINT #1:X2(I);Y2(I);Z2(I)
NEXT I
PRINT #1:"POLYGONS";N;5*N
FOR I=0 TO 2*N-1 STEP 2
PRINT #1:4;I;I+2;I+3;I+1 !'meshデータ
NEXT I
PRINT #1:"POINT_DATA";2*(N+1)
PRINT #1:"SCALARS height float"
PRINT #1:"LOOKUP_TABLE default"
FOR I=0 TO N
PRINT #1:Z1(I)
PRINT #1:Z2(I)
NEXT I
CLOSE #1
END
|
|