古代生物

 投稿者:SECOND  投稿日:2008年11月25日(火)03時38分43秒
  !古代生物( 再投稿コンパクト)

SET TEXT FONT "MS 明朝",12
SET TEXT BACKGROUND "OPAQUE"
SET POINT STYLE 1
!----------------
LET t$="アンモナイト"
LET N=101
LET xm=-0.63
LET ym=0.5
LET h=1.5
RANDOMIZE 19650218
SET WINDOW xm-h,xm+h, ym-h,ym+h
PLOT TEXT,AT xm+h*0.1,ym+h*0.85:t$& "    N="& USING$("###",N)
SET POINT COLOR 44
CALL fa(N, 0.4, 0.2)
beep
!----------------
LET t$="シダの葉"
LET N=19
LET xm=0.32
LET ym=0.5
LET h=0.6
RANDOMIZE 19650218
SET WINDOW xm-h,xm+h, ym-h,ym+h
DRAW axes
PLOT TEXT,AT xm+h*0.1,ym+h*0.7:t$& "    N="& USING$("###",N)
PLOT TEXT,AT xm-h*0.75, ym+h*0.85:"しばらく御待ち下さい。"
SET POINT COLOR 10
CALL fs(N, 0,0)
CALL fs(N, 0,0)
beep
PLOT TEXT,AT xm-h*0.75, ym+h*0.85:" 描画の終了     "

!------------------------------------------------------------
! 複数の縮小アファイン変換 (アンモナイト)
DEF A1x(x,y)=-0.289993*x-0.001347*y+0.593333
DEF A1y(x,y)= 0.001986*x-0.196662*y-0.32 ! p1=0.06124
DEF A2x(x,y)=-0.073058*x-0.024834*y+0.793333
DEF A2y(x,y)=-0.006353*x+0.285589*y-0.056667 ! p2=0.022236
DEF A3x(x,y)= 0.939186*x-0.218787*y-0.046667
DEF A3y(x,y)= 0.214337*x+0.958685*y+0.01 ! p3=0.916524
!------------------------------------------------------------
SUB fa(k, x,y)
   IF 0< k THEN
      CALL fa(k-1, A3x(x,y),A3y(x,y))
      IF RND< 0.0668176 THEN CALL fa(k-1, A1x(x,y),A1y(x,y))
      IF RND< 0.024261 THEN CALL fa(k-1, A2x(x,y),A2y(x,y))
   END IF
   PLOT POINTS: x,y
END SUB

!------------------------------------------------------------
! 複数の縮小アファイン変換 (シダの葉)
DEF W1x(x,y)= 0.836*x+0.044*y
DEF W1y(x,y)=-0.044*x+0.836*y+0.169 ! p1=0.4
DEF W2x(x,y)=-0.141*x+0.302*y
DEF W2y(x,y)= 0.302*x+0.141*y+0.127 ! p2=0.2
DEF W3x(x,y)= 0.141*x-0.302*y
DEF W3y(x,y)= 0.302*x+0.141*y+0.169 ! p3=0.2
DEF W4x(x,y)= 0
DEF W4y(x,y)= 0.175337*y ! p4=0.2
!------------------------------------------------------------
!確率的プロット(p1~p4)は、変形されています。
SUB fs(k, x,y)
   IF 0< k THEN
      CALL fs(k-1, W1x(x,y),W1y(x,y))
      IF RND< 0.3 THEN CALL fs(k-1, W2x(x,y),W2y(x,y))
      IF RND< 0.3 THEN CALL fs(k-1, W3x(x,y),W3y(x,y))
      IF RND< 0.3 THEN CALL fs(k-1, W4x(x,y),W4y(x,y))
   END IF
   PLOT POINTS: x,y
END SUB

END
 

戻る