トーラス

 投稿者:しばっち  投稿日:2011年 8月14日(日)23時14分23秒
  OPTION BASE 0
RANDOMIZE
LET N=60
LET M=60
DIM X(N,M),Y(N,M),Z(N,M)
!'-----------------------------------------------------------------
LET R=INT(RND*40)+5
LET RR=INT(RND*150)+R !'RR>R
LET FF$="トーラス" & STR$(RR) & "_" & STR$(R)
FOR J=0 TO M
   FOR I=0 TO N
      LET ALPHA=I*360/N
      LET BETA=J*360/M
      LET  X(I,J)=(RR+R*COS(ALPHA*PI/180))*COS(BETA*PI/180)
      LET  Z(I,J)=(RR+R*COS(ALPHA*PI/180))*SIN(BETA*PI/180)
      LET  Y(I,J)=R*SIN(ALPHA*PI/180)
   NEXT I
NEXT J
!'-----------------------------------------------------------------
!'LET R=INT(RND*40)+5
!'LET R1=INT(RND*150)+R
!'LET R2=INT(RND*40)
!'LET RR=INT(RND*40)+5
!'LET K=INT(RND*10)+1
!'LET FF$="変形トーラス" & STR$(R1) & "_" & STR$(R2) & "_" & STR$(R) & "_" & STR$(RR) & "_" & STR$(K)
!'FOR J=0 TO M
!'   FOR I=0 TO N
!'      LET ALPHA=I*360/N
!'      LET BETA=J*360/M
!'      LET  X(I,J)=(R1+R*COS(ALPHA*PI/180))*(R2+RR*COS(K*BETA*PI/180))*COS(BETA*PI/180)
!'      LET  Z(I,J)=(R1+R*COS(ALPHA*PI/180))*(R2+RR*COS(K*BETA*PI/180))*SIN(BETA*PI/180)
!'      LET  Y(I,J)=R*SIN(ALPHA*PI/180)*(R2+RR*COS(K*BETA*PI/180))
!'   NEXT I
!'NEXT J
!'-----------------------------------------------------------------
!'LET R=INT(RND*40)+5
!'LET RR=INT(RND*150)+R
!'LET R1=INT(RND*30)
!'LET K=INT(RND*10)+1
!'LET FF$="歪んだトーラス" & STR$(RR) & "_" & STR$(R) & "_" & STR$(R1) & "_" & STR$(K)
!'FOR J=0 TO M
!'   FOR I=0 TO N
!'      LET ALPHA=I*360/N
!'      LET BETA=J*360/M
!'      LET  X(I,J)=(RR+R*COS(ALPHA*PI/180))*COS(BETA*PI/180)
!'      LET  Z(I,J)=(RR+R*COS(ALPHA*PI/180))*SIN(BETA*PI/180)
!'      LET  Y(I,J)=R*SIN(ALPHA*PI/180)+R1*SIN(K*BETA*PI/180)
!'   NEXT I
!'NEXT J
FILE GETSAVENAME F$,"DXFファイル|*.DXF"
IF F$="" THEN STOP
IF RIGHT$(F$,1)="!" THEN LET F$=F$(1:LEN(F$)-1) & FF$
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 I=0 TO N-1
   FOR J=0 TO M-1
      PRINT #1:"0"
      PRINT #1:"3DFACE"
      PRINT #1:"8"
      PRINT #1:"LAYER1"
      PRINT #1:"62"
      PRINT #1:"1"
      PRINT #1:"10"
      PRINT #1:X(I+1,J+1)
      PRINT #1:"20"
      PRINT #1:Y(I+1,J+1)
      PRINT #1:"30"
      PRINT #1:Z(I+1,J+1)
      PRINT #1:"11"
      PRINT #1:X(I+1,J)
      PRINT #1:"21"
      PRINT #1:Y(I+1,J)
      PRINT #1:"31"
      PRINT #1:Z(I+1,J)
      PRINT #1:"12"
      PRINT #1:X(I,J)
      PRINT #1:"22"
      PRINT #1:Y(I,J)
      PRINT #1:"32"
      PRINT #1:Z(I,J)
      PRINT #1:"13"
      PRINT #1:X(I,J+1)
      PRINT #1:"23"
      PRINT #1:Y(I,J+1)
      PRINT #1:"33"
      PRINT #1:Z(I,J+1)
   NEXT  J
NEXT  I
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END
 

戻る