Barnsley fern: Difference between revisions
Content added Content deleted
Line 1,720: | Line 1,720: | ||
x::Float64 |
x::Float64 |
||
y::Float64 |
y::Float64 |
||
age::Int |
|||
fern::Matrix{RGB} |
fern::Matrix{RGB} |
||
function BarnsleyFern(width, height) |
function BarnsleyFern(width, height) |
||
f = new(width, height, RGB(0.0, 1.0, 0.0), RGB(1.0, 1.0, 1.0), 0.0, 0. |
f = new(width, height, RGB(0.0, 1.0, 0.0), RGB(1.0, 1.0, 1.0), 0.0, 0.0, |
||
[RGB(0.0, 0.0, 0.0) for x in 1:width, y in 1:height]) |
[RGB(0.0, 0.0, 0.0) for x in 1:width, y in 1:height]) |
||
x, y = scale(f) |
x, y = scale(f) |
||
Line 1,747: | Line 1,746: | ||
f.fern[Int(trunc(newx)) + 1, Int(trunc(newy)) + 1] = f.color |
f.fern[Int(trunc(newx)) + 1, Int(trunc(newy)) + 1] = f.color |
||
end |
end |
||
f.age += iterations |
|||
end |
end |
||