
-----------------------------------
MysticAngel
Thu Mar 27, 2003 6:34 pm

Julia sets - fractals
-----------------------------------
this a really good and a neat program. i did ran into a some trouble and coudnt figure out the problem, but i did it.its fun. u care to run it u would find it pretty fun and the fractals are beautiful. the higher the maxcount the bettter the picture and u can also play around with the count + 55. u canchange to any color by saying count + something. anyways enjoy.



var p, q : real
var maxcount, count : int
var win1, win2 : int
var rx, ry, rx2, ry2 : real
var col : string

put "Please enter a value for p "
get p
put " "
put "Please enter a value for q"
get q
put ""
loop
    put "please enter max count between 20 and 200 " 
    get maxcount
    exit when maxcount >= 20 and maxcount  4| count = maxcount
            count := count + 1
        end loop
        if count < maxcount then
            Draw.Dot (x, y, count + 55)
        else
            Draw.Dot (x, y, white)
        end if
    end for
end for


MOD Edit: I'm impressed... Mostly with the fact that you stuck to your goals and accompleshed them. Sorry we couldn't help you that much with it :( Also, if anyone comes up with some interesting results, post the numbers used :wink: +15Bits - Tony

-----------------------------------
Catalyst
Thu Mar 27, 2003 7:44 pm


-----------------------------------
im glad u figured out ur prob, sorry i didnt post in time(doesnt matter now), heres my prog:

note: to change the res, just change the window size



View.Set ("graphics:150;150,nobuttonbar,position:300;300")
proc ColorAdd (c1, c2, n : int)
    var clr : int
    var r1, g1, b1 : real
    var r2, g2, b2 : real
    var p, p0 : real
    RGB.GetColor (c1, r1, g1, b1)
    RGB.GetColor (c2, r2, g2, b2)
    const a := 50
    for i : 1 .. n
        p := (i / n) * 100
        p0 := 100 - p
        clr := RGB.AddColor ((((r1 * p) + (r2 * p0)) / 2) / a, (((g1 * p) + (g2 * p0)) / 2) / a, (((b1 * p) + (b2 * p0)) / 2) / a)
    end for
end ColorAdd
ColorAdd (yellow, blue, 25)
function distance (x1, y1, x2, y2 : real) : real
    result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
end distance
var ox, oy : real := maxx div 2
type complex :
    record
        r : real
        i : real
    end record
function AddComplex (comp1, comp2 : complex) : complex
    var hold : complex
    hold.r := comp1.r + comp2.r
    hold.i := comp1.i + comp2.i
    result hold
end AddComplex
function MultComplex (comp1, comp2 : complex) : complex
    var hold : complex
    hold.r := (comp1.r * comp2.r) - (comp1.i * comp2.i)
    hold.i := (comp1.r * comp2.i) + (comp1.i * comp2.r)
    result hold
end MultComplex
function Iterate (comp1 : complex, C : complex) : complex
    var hold : complex
    hold := MultComplex (comp1, comp1)
    hold := AddComplex (hold, C)
    result hold
end Iterate
const maxI := 75
var count : int := 0
var dwell : array 0 .. maxx * 3, 0 .. maxy * 3 of real
var transX, transY : int := maxx div 2
var c : complex
c.r := -0.79
c.i := 0.16
var hold : complex
put "Rendering..."
for x : -transX .. maxx
    for y : -transY .. maxy
        hold.r := x / (maxx div 2)
        hold.i := y / (maxy div 2)
        loop
            count += 1
            exit when count >= maxI
            if distance (hold.r, hold.i, ox, oy) 