花型球体

 投稿者:しばっち  投稿日:2011年 8月14日(日)23時16分22秒
  RANDOMIZE
OPTION BASE 0
LET N=60
DIM X(N,N),Y(N,N),Z(N,N)
FILE GETSAVENAME F$,"DXFファイル|*.DXF"
IF F$="" THEN STOP
LET A=INT(RND*10+1)
LET B=INT(RND*10+1)
LET NN=INT(RND*10+1)
LET MM=INT(RND*10+1)
LET RR=INT(RND*8)
LET R=100
IF RIGHT$(F$,1)="!" THEN LET F$=F$(1:LEN(F$)-1) & "花型球体" & "_" & STR$(A) & "_" & STR$(B) & "_" & STR$(NN) & "_" & STR$(MM) & "_" & STR$(RR)
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
   FOR J=0 TO N
      LET ALPHA=I*180/N
      LET BETA=J*360/N
      LET RO=FUNC(R,A/10,B/10,NN,MM,RR/10,ALPHA,BETA)
      LET  X(I,J)=-RO*SIN(ALPHA*PI/180)*COS(BETA*PI/180)
      LET  Y(I,J)=RO*COS(ALPHA*PI/180)
      LET  Z(I,J)=RO*SIN(ALPHA*PI/180)*SIN(BETA*PI/180)
   NEXT J
NEXT I
FOR I=0 TO N-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(0,0)
   PRINT #1:"20"
   PRINT #1:Y(0,0)
   PRINT #1:"30"
   PRINT #1:Z(0,0)
   PRINT #1:"11"
   IF I+1=N THEN PRINT #1:X(1,N) ELSE PRINT #1:X(1,I+1)
   PRINT #1:"21"
   IF I+1=N THEN PRINT #1:Y(1,N) ELSE PRINT #1:Y(1,I+1)
   PRINT #1:"31"
   IF I+1=N THEN PRINT #1:Z(1,N) ELSE PRINT #1:Z(1,I+1)
   PRINT #1:"12"
   PRINT #1:X(1,I)
   PRINT #1:"22"
   PRINT #1:Y(1,I)
   PRINT #1:"32"
   PRINT #1:Z(1,I)
NEXT I
FOR I=1 TO N-1
   FOR J=1 TO N
      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)
      PRINT #1:"20"
      PRINT #1:Y(I+1,J)
      PRINT #1:"30"
      PRINT #1:Z(I+1,J)
      PRINT #1:"11"
      PRINT #1:X(I+1,J-1)
      PRINT #1:"21"
      PRINT #1:Y(I+1,J-1)
      PRINT #1:"31"
      PRINT #1:Z(I+1,J-1)
      PRINT #1:"12"
      PRINT #1:X(I,J-1)
      PRINT #1:"22"
      PRINT #1:Y(I,J-1)
      PRINT #1:"32"
      PRINT #1:Z(I,J-1)
      PRINT #1:"13"
      PRINT #1:X(I,J)
      PRINT #1:"23"
      PRINT #1:Y(I,J)
      PRINT #1:"33"
      PRINT #1:Z(I,J)
   NEXT  J
NEXT  I
FOR I=0 TO N-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(N,N)
   PRINT #1:"20"
   PRINT #1:Y(N,N)
   PRINT #1:"30"
   PRINT #1:Z(N,N)
   PRINT #1:"11"
   PRINT #1:X(N-1,I)
   PRINT #1:"21"
   PRINT #1:Y(N-1,I)
   PRINT #1:"31"
   PRINT #1:Z(N-1,I)
   PRINT #1:"12"
   PRINT #1:X(N-1,I+1)
   PRINT #1:"22"
   PRINT #1:Y(N-1,I+1)
   PRINT #1:"32"
   PRINT #1:Z(N-1,I+1)
NEXT I
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END

EXTERNAL  FUNCTION FUNC(R,A,B,N,M,RR,ALPHA,BETA) !'バラ曲線
LET FUNC=R*(1+A*SIN(ALPHA*N*PI/180)*(1+B*SIN(BETA*M*PI/180)+RR))
END FUNCTION

花型球体(A=3,B=10,NN=6,MM=8,RR=3)
 

戻る