-- just amused)
shape = Shape.new()
shape:setLineStyle(1, 0x00f000)
stage:addChild(shape)
x = 0
y = 0
for i = 1, 30000 do
local r = math.random()
if r < 0.01 then
a = 0
b = 0
c = 0
d = 0.16
e = 0
f = 0
elseif r < 0.8 then
a = 0.85
b = 0.04
c = -0.04
d = 0.85
e = 0
f = 1.6
elseif r < 0.9 then
a = 0.2
b = -0.26
c = 0.23
d = 0.22
e = 0
f = 1.6
elseif r < 1 then
a = -0.15
b = 0.28
c = 0.26
d = 0.24
e = 0
f = 0.44
end
x1 = (a * x) + (b * y) + e
y1 = (c * x) + (d * y) + f
x = x1
y = y1
shape:beginPath()
shape:moveTo(x*80+200,y*80)
shape:lineTo(x*80+201,y*80)
shape:endPath()
end
Comments
- Ian
Reworked version)
dot.png just 2x2px png ) or 1x1)
--[[
by Doctor Max
--]]
Fern = {
0.01, 0, 0, 0, 0.16, 0, 0,
0.86, 0.85, 0.04, -0.04, 0.85, 0, 1.9,
0.93, 0.20, -0.26, 0.23, 0.22, 0, 1.9,
1, -0.15, 0.28, 0.26, 0.24, 0, 0.44
}
Dragon = {
0.787473, 0.824074, 0.281482, -0.212346, 0.864198, -1.882290, -0.110607,
0.1, 0.088272, 0.520988, -0.463889, -0.377778, 0.785360, 8.095795,
0.1, 0.088272, 0.520988, -0.463889, -0.377778, 0.785360, 8.095795,
1, 0.088272, 0.520988, -0.463889, -0.377778, 0.785360, 8.095795
}
local function Ifs(t)
local x = 0
local y = 0
for i = 1, 50000 do
local r = math.random()
if r <= t[1] then
a = t[2]; b = t[3]; c = t[4]; d = t[5]; e = t[6]; f = t[7]
elseif r <= t[8] then
a = t[9]; b = t[10]; c = t[11]; d = t[12]; e = t[13]; f = t[14]
elseif r <= t[15] then
a = t[16]; b = t[17]; c = t[18]; d = t[19]; e = t[20]; f = t[21]
elseif r <= t[22] then
a = t[23]; b = t[24]; c = t[25]; d = t[26]; e = t[27]; f = t[28]
end
x1 = a*x + b*y + e
y1 = c*x + d*y + f
x = x1
y = y1
local bitmap = Bitmap.new(Texture.new("dot.png"))
bitmap:setPosition(x*40+200, y*40+200)
stage:addChild(bitmap)
end
end
--Ifs(Fern)
Ifs(Dragon)
[.......]
local bitmap = Bitmap.new(Texture.new("dot.png"))
bitmap:setPosition(x*140+200, y*140+200)
--stage:addChild(bitmap)
rt:draw(bitmap)
end
end
rt = RenderTarget.new(800, 480, true)
Ifs(Fern)
local brt = Bitmap.new(rt)
stage:addChild(brt)
I have done this a long time on zx-spectrum. before fond demoscene) so I have such trivial matters
and attractors for Fern, Dragon took the program FRACTINT. But he figured out what was what. Coming soon to morph from one to another fractal.
http://www.fractint.net