凝集体

 投稿者:しばっち  投稿日:2011年 8月14日(日)23時21分16秒
  !'ボクセル表現(VOXEL)
RANDOMIZE
LET  N = 80
DIM P(N,N,N)
LET  M = N / 2
LET  P(M,M,M) = 1
LET  R = M - 5
LET  KK = .01
FILE GETSAVENAME F$,"dxfファイル|*.dxf"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".DXF")=0 THEN LET F$=F$ & ".dxf"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"0"
PRINT #1:"SECTION"
PRINT #1:"2"
PRINT #1:"ENTITIES"
FOR II = 1 TO 2000
   LET  TH1 = RND * PI
   LET  TH2 = RND * 2 * PI
   LET  RX = R * COS(TH1)*COS(TH2)
   LET  RY = R * COS(TH1)*SIN(TH2)
   LET  RZ = R * SIN(TH1)
   DO
      LET  XX = RX + 2 * (RND-.5)-RX * KK !'ランダムウォーク
      LET  YY = RY + 2 * (RND-.5)-RY * KK
      LET  ZZ = RZ + 2 * (RND-.5)-RZ * KK
      LET  X = XX + M
      LET  Y = YY + M
      LET  Z = ZZ + M
      FOR I = -1 TO 1
         FOR J = -1 TO 1
            FOR K = -1 TO 1
               IF P(X,Y,Z) = 0 AND P(X+I,Y+J,Z+K) = 1 THEN
                  LET  P(X,Y,Z) = 1
                  CALL CUBE(#1,X,Y,Z,1)
                  EXIT DO
               END IF
            NEXT K
         NEXT J
      NEXT I
      LET  RX = XX
      LET  RY = YY
      LET  RZ = ZZ
   LOOP
NEXT II
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END

以下省略
EXTERNAL  SUB CUBE(#1,X,Y,Z,L)
END SUB
 

戻る