Barnsley fern: Difference between revisions

Using Real Math module
(Added solution for Action!)
(Using Real Math module)
Line 28:
=={{header|Action!}}==
{{libheader|Action! Tool Kit}}
{{libheader|Action! Real Math}}
<lang Action!>INCLUDE "D2H6:REALREALMATH.ACT" ;from the Action! Tool Kit
 
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
Line 48 ⟶ 49:
ValR("1.6",r160)
RETURN
 
INT FUNC MyRealToInt(REAL POINTER r)
BYTE ARRAY x
REAL tmp
INT i
 
x=r
IF (x(0)&$80)=0 THEN
i=RealToInt(r)
ELSE
RealAssign(r,tmp)
x=tmp
x(0)==&$7F
i=-RealToInt(tmp)
FI
RETURN (i)
 
PROC Fern(REAL POINTER scale)
Line 76 ⟶ 61:
RealMult(x,scale,tmp1)
RealMult(y,scale,tmp2)
ix=MyRealToIntRound(tmp2) ;fern is rotated to fit the screen size
iy=MyRealToIntRound(tmp1)+85
 
IF (ix>=0) AND (ix<=319) AND (iy>=0) AND (iy<=191) THEN
Anonymous user