超楕円体

 投稿者:しばっち  投稿日:2011年 8月14日(日)23時17分12秒
  OPTION BASE 0
RANDOMIZE
LET N=80 !'分割数
DIM X(N,N),Y(N,N),Z(N,N)
LET NN=INT(RND*70)+1
LET MM=INT(RND*70)+1
LET RX=INT(RND*200)+50
LET RY=INT(RND*200)+50
LET RZ=INT(RND*200)+50
FILE GETSAVENAME F$,"DXFファイル|*.DXF"
IF F$="" THEN STOP
IF RIGHT$(F$,1)="!" THEN LET F$=F$(1:LEN(F$)-1) & "超楕円体" & STR$(RX) & "_" & STR$(RY) &  "_" & STR$(RZ) & "_" & STR$(NN) & "_" & STR$(MM)
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"
LET NN=NN/10
LET MM=MM/10
FOR I=0 TO N
   FOR J=0 TO N
      LET ALPHA=I*180/N
      LET BETA=J*360/N
      LET  X(I,J)=-RX*SGN(SIN(ALPHA*PI/180))*ABS(SIN(ALPHA*PI/180))^NN*SGN(COS(BETA*PI/180))*ABS(COS(BETA*PI/180))^MM
      LET  Y(I,J)=RY*SGN(COS(ALPHA*PI/180))*ABS(COS(ALPHA*PI/180))^NN
      LET  Z(I,J)=RZ*SGN(SIN(ALPHA*PI/180))*ABS(SIN(ALPHA*PI/180))^NN*SGN(SIN(BETA*PI/180))*ABS(SIN(BETA*PI/180))^MM
   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
 

戻る