To Gilles new version of DivideJulibrots

3 views
Skip to first unread message

Andrea Spinozzi

unread,
Oct 4, 2009, 6:48:49 PM10/4/09
to UFB...@googlegroups.com
Hi Gilles, All,

I resolved in this way(but need to implement the slope again), i
deleted the julia switch and added the C sequence, cancelled the fn1
because it hadn't sense, at the end this is my formulae style.
What do you think about?

Ciao
Andrea

Ps:Maybe i'll must write to Jim Muth to inform him of my versions,
this is the second formula that i use from his FOTD site.

SlopeDivideJulibrot{
; draws 4-D slices of DivideBrot Julibrots
; Original code by Jim Muth, Slope version and implementation by Andrea Spinozzi
; For a classic Julia use real(p1)=90.0 and real(p2)=90.0 and the center/switch
; parameter like a seed.
; October2009

Init:

pix=pixel

u=real(pix)
v=imag(pix)

a=pi*real(p1*0.0055555555555556)
b=pi*imag(p1*0.0055555555555556)
g=pi*real(p2*0.0055555555555556)
d=pi*imag(p2*0.0055555555555556)

ca=cos(a)
cb=cos(b)
sb=sin(b)
cg=cos(g)
sg=sin(g)
cd=cos(d)
sd=sin(d)

aa=-(real(p4)-2)
bb=(imag(p4)+0.00000000000000000000001)

p=u*cg*cd-v*(ca*sb*sg*cd+ca*cb*sd)
q=u*cg*sd+v*(ca*cb*cd-ca*sb*sg*sd)
r=u*sg+v*ca*sb*cg
s=v*sin(a)

c=p+flip(q)+p3
z=r+flip(s)+p5

int modby=@seq+2
int iter=0

Loop:

int method=iter%modby

if @zmethod==0
if method==0
z=sqr(z)/((z)^(aa)+bb)+fn1(c)+@p6
else
z=sqr(z)/((z)^(aa)+bb)+fn2(c)+@p7
endif
else
if method==0
z=sin(z)/((z)^(aa)+bb)+fn1(c)+@p6
else
z=sin(z)/((z)^(aa)+bb)+fn2(c)+@p7
endif
endif


iter=iter+1

Bailout:

|z| < @bailout

Default:

title="SlopeDivideJulibrot"
periodicity=0
method=multipass
maxiter=250

Param bailout
caption="Bailout"
default=1000
min=0.0
Endparam

Heading
caption="Parameters"
Endheading

Param zmethod
caption="Z Method"
enum="Normal""Sin"
default=0
Endparam
Param p1
caption="Parameter 1"
default=(0.0,0.0)
Endparam
Param p2
caption="Parameter 2"
default=(0.0,0.0)
Endparam
Param p4
caption="Exponent"
default=(2.0,0.0)
Endparam
Param p3
caption="Center/Swicth"
default=(0.0,0.0)
Endparam
Param p5
caption="Center/Init"
default=(0.0,0.0)
Endparam

Heading
caption="Sequence C"
Endheading

Param seq
caption="Sequence Lengh"
enum="1""2"
default=0
Endparam
Param p6
caption="Factor 1"
default=(0.0,0.0)
Endparam
Param p7
caption="Factor 2"
default=(0.0,0.0)
Endparam

Heading
caption="Functions"
Endheading

Func fn1
caption="Function factor 1"
default=ident()
Endfunc
Func fn2
caption="Function factor 2"
default=ident()
Endfunc

}

Andrea Spinozzi

unread,
Oct 4, 2009, 8:20:45 PM10/4/09
to UFB...@googlegroups.com
Well,
Here's the final version with the slope.....It seems to work.
Andrea

Ps:Time to bed or tomorrow i'm a zombie...LOL

SlopeDivideJulibrot{
; draws 4-D slices of DivideBrot Julibrots
; Original code by Jim Muth, Slope version and implementation by Andrea Spinozzi
; For a classic Julia use real(p1)=90.0 and real(p2)=90.0 and the center/switch
; parameter like a seed.
; October2009

Init:

pix1=pixel
pix2=pixel+@offset
pix3=pixel+flip(@offset)

u1=real(pix1)
u2=real(pix2)
u3=real(pix3)
v1=imag(pix1)
v2=imag(pix2)
v3=imag(pix3)


a1=pi*real(p1*0.0055555555555556)
a2=pi*real(p1*0.0055555555555556)
a3=pi*real(p1*0.0055555555555556)
b1=pi*imag(p1*0.0055555555555556)
b2=pi*imag(p1*0.0055555555555556)
b3=pi*imag(p1*0.0055555555555556)
g1=pi*real(p2*0.0055555555555556)
g2=pi*real(p2*0.0055555555555556)
g3=pi*real(p2*0.0055555555555556)
f1=pi*imag(p2*0.0055555555555556)
f2=pi*imag(p2*0.0055555555555556)
f3=pi*imag(p2*0.0055555555555556)


ca1=cos(a1)
ca2=cos(a2)
ca3=cos(a3)
cb1=cos(b1)
cb2=cos(b2)
cb3=cos(b3)
sb1=sin(b1)
sb2=sin(b2)
sb3=sin(b3)
cg1=cos(g1)
cg2=cos(g2)
cg3=cos(g3)
sg1=sin(g1)
sg2=sin(g2)
sg3=sin(g3)
cd1=cos(f1)
cd2=cos(f2)
cd3=cos(f3)
sd1=sin(f1)
sd2=sin(f2)
sd3=sin(f3)


aa1=-(real(p4)-2)
aa2=-(real(p4)-2)
aa3=-(real(p4)-2)
bb1=(imag(p4)+0.00000000000000000000001)
bb2=(imag(p4)+0.00000000000000000000001)
bb3=(imag(p4)+0.00000000000000000000001)


t1=u1*cg1*cd1-v1*(ca1*sb1*sg1*cd1+ca1*cb1*sd1)
t2=u2*cg2*cd2-v2*(ca2*sb2*sg2*cd2+ca2*cb2*sd2)
t3=u3*cg3*cd3-v3*(ca3*sb3*sg3*cd3+ca3*cb3*sd3)
q1=u1*cg1*sd1+v1*(ca1*cb1*cd1-ca1*sb1*sg1*sd1)
q2=u2*cg2*sd2+v2*(ca2*cb2*cd2-ca2*sb2*sg2*sd2)
q3=u3*cg3*sd3+v3*(ca3*cb3*cd3-ca3*sb3*sg3*sd3)
r1=u1*sg1+v1*ca1*sb1*cg1
r2=u2*sg2+v2*ca2*sb2*cg2
r3=u3*sg3+v3*ca3*sb3*cg3
h1=v1*sin(a1)
h2=v2*sin(a2)
h3=v3*sin(a3)


c1=t1+flip(q1)+p3
c2=t2+flip(q2)+p3
c3=t3+flip(q3)+p3
z1=r1+flip(h1)+p5
z2=r2+flip(h2)+p5
z3=r3+flip(h3)+p5


int modby=@seq+2
int iter=0


;;; slope stuff
int done = 2
float e1 = 0.0; potentials
float e2 = 0.0
float e3 = 0.0
float vx = 0.0; normal vector
float vy = 0.0
float vz = 0.0
float vd = 0.0
float d1 = 0.0; distances
float d2 = 0.0
float d3 = 0.0
float s1 = 1.0e20; smallest distances
float s2 = 1.0e20
float s3 = 1.0e20
float iterexp1 = 0.0
float iterexp2 = 0.0
float iterexp3 = 0.0

Loop:

int method=iter%modby


if @zmethod==0
if method==0
z1=sqr(z1)/((z1)^(aa1)+bb1)+fn1(c1)+@p6
z2=sqr(z2)/((z2)^(aa2)+bb2)+fn1(c2)+@p6
z3=sqr(z3)/((z3)^(aa3)+bb3)+fn1(c3)+@p6
else
z1=sqr(z1)/((z1)^(aa1)+bb1)+fn2(c1)+@p7
z2=sqr(z2)/((z2)^(aa2)+bb2)+fn2(c2)+@p7
z3=sqr(z3)/((z3)^(aa3)+bb3)+fn2(c3)+@p7
endif
else
if method==0
z1=sin(z1)/((z1)^(aa1)+bb1)+fn1(c1)+@p6
z2=sin(z2)/((z2)^(aa2)+bb2)+fn1(c2)+@p6
z3=sin(z3)/((z3)^(aa3)+bb3)+fn1(c3)+@p6
else
z1=sin(z1)/((z1)^(aa1)+bb1)+fn2(c1)+@p7
z2=sin(z2)/((z2)^(aa2)+bb2)+fn2(c2)+@p7
z3=sin(z3)/((z3)^(aa3)+bb3)+fn2(c3)+@p7
endif
endif


if (@slope == true)
;;;; process slope
if (@zmode == 85)
iterexp1 = iterexp1 + exp(-cabs(z1))
iterexp2 = iterexp2 + exp(-cabs(z2))
iterexp3 = iterexp3 + exp(-cabs(z3))
endif
done = done + 1; increment iteration counter

if (@zmode == 0) ; smallest |z|
d1 = |z1|; get current distances from origin
d2 = |z2|
d3 = |z3|
if (d1 < s1); update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 1) ; smallest |real(z)|
d1 = abs(real(z1)); get current distances from the i axis
d2 = abs(real(z2))
d3 = abs(real(z3))
if (d1 < s1); update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 2) ; smallest |imag(z)|
d1 = abs(imag(z1)); get current distances from the r axis
d2 = abs(imag(z2))
d3 = abs(imag(z3))
if (d1 < s1); update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 3) ; smallest |real(z)|+|imag(z)|
d1 = abs(real(z1))+abs(imag(z1)); get current distances from the i axis
d2 = abs(real(z2))+abs(imag(z2))
d3 = abs(real(z3))+abs(imag(z3))
if (d1 < s1); update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 4) ; smallest |atan(z)|
d1 = abs(atan2(z1)); get current angles
d2 = abs(atan2(z2))
d3 = abs(atan2(z3))
if (d1 < s1); update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 5) ; smallest |function1(z)|
d1 = abs(real(@fnsl(z1))) + abs(imag(@fnsl(z1))) ;
get current distances
d2 = abs(real(@fnsl(z2))) + abs(imag(@fnsl(z2)))
d3 = abs(real(@fnsl(z3))) + abs(imag(@fnsl(z3)))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 6) ; smallest |function2(z)|
d1 = cabs(@fnsl(z1)) ; get current distances
d2 = cabs(@fnsl(z2))
d3 = cabs(@fnsl(z3))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 7) ; smallest Lemniscate Distance
theta = atan(imag(#z)/real(#z))
r = 1.5*@a*(cos(2*theta))^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 8) ; smallest Cardiod Distance
theta = atan(imag(#z)/real(#z))
r = 5*@a*(1-cos(theta))
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 9) ; smallest Conchoid Distance
theta = atan(imag(#z)/real(#z))
r = 0.2*(@a + @b*cos(theta))/cos(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 10) ; smallest Cycloid Distance
theta = atan(imag(#z)/real(#z))
r = 2*@a*cabs(#z)
polar = r*(theta-sin(theta)) + flip(r*(1-cos(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 11) ; smallest Archimedes Distance
theta = atan(imag(#z)/real(#z))
r = 3.5*@a*theta
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 12) ; smallest Log Spiral Distance
theta = atan(imag(#z)/real(#z))
r = exp(@a*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 13) ; smallest Rose Distance
theta = atan(imag(#z)/real(#z))
r = @a*cos(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 14) ; smallest Bifolium Distance
theta = atan(imag(#z)/real(#z))
r = 16*@a*sin(theta)^2*cos(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 15) ; smallest Astroid Distance
theta = atan(imag(#z)/real(#z))
af1 = @afn1(theta)^imag(@apwr)
af2 = @afn2(theta)^imag(@apwr)
polar = 1.75*@a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 16) ; smallest Cissoid of
Diocles Distance
theta = atan(imag(#z)/real(#z))
r = 2*@a*sin(theta)*tan(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 17) ; smallest Cochleoid Distance
theta = atan(imag(#z)/real(#z))
r = 1.25*@a*sin(theta)/theta
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 18) ; smallest Folium of
Descartes Distance
theta = atan(imag(#z)/real(#z))
r = @a*tan(theta)/(cos(theta)*(1+tan(theta)^3))
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 19) ; smallest Limacon of Pascal Distance
theta = atan(imag(#z)/real(#z))
r = 0.03*@b + 1.5*@a*cos(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 20) ; smallest Lituus Distance
theta = atan(imag(#z)/real(#z))
r = 0.6*@a/theta^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 21) ; smallest Nephroid Distance
theta = atan(imag(#z)/real(#z))
af1 = 3*@afn1(theta) - @afn1(theta/3)
af2 = 3*@afn2(theta) - @afn2(theta/3)
polar = 0.75*@a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 22) ; smallest Strophoid Distance
theta = atan(imag(#z)/real(#z))
r = 0.2*@b*sin(@a-2*theta)/sin(@a-theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 23) ; smallest Witch of Agnesi
theta = atan(imag(#z)/real(#z))
af1 = 2*cotan(theta)
af2 = 1-cos(2*theta)
polar = 0.1*@a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 24) ; smallest Curtate Cycloid
theta = atan(imag(#z)/real(#z))
af1 = 2*@a*theta - 0.1*@b*@afn2(theta)
af2 = 2*@a - 0.1*@b*@afn1(theta)
polar = af1 + flip(af2)
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 25) ; smallest Epicycloid
theta = atan(imag(#z)/real(#z))
af1 = (5*@a+@b)*@afn1(theta) - @b*@afn1((5*@a+@b)*theta/@b)
af2 = (5*@a+@b)*@afn2(theta) - @b*@afn2((5*@a+@b)*theta/@b)
polar = 0.5*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 26) ; smallest Ellipse Evolute
theta = atan(imag(#z)/real(#z))
af1 = (@a^2-(0.7*@b)^2)/@a*@afn1(theta)^(real(@apwr))
af2 = ((0.7*@b)^2-@a^2)/(0.7*@b)*@afn2(theta)^(imag(@apwr))
polar = 0.2*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 27) ; smallest Tractrix
theta = atan(imag(#z)/real(#z))
af1 = @a*(log(tan(theta/2))-@afn1(theta))
af2 = @a*@afn2(theta)
polar = 0.25*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 28) ; smallest Kampyle of
Eudoxus Distance
theta = atan(imag(#z)/real(#z))
r = @a/cos(theta)^2
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 29) ; smallest Circle Catacaustic
theta = atan(imag(#z)/real(#z))
af1 = 2*@b*(1-3*2*@b*cos(theta)+2*2*@b*cos(theta)^3)/(-(1+2*(2*@b)^2)+3*2*@b*cos(theta))
af2 = 2*(2*@b)^2*sin(theta)^3/(1+2*(2*@b)^2-3*@b*cos(theta))
polar = 1.5*@a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 30) ; smallest Deltoid Catacaustic
theta = atan(imag(#z)/real(#z))
af1 = 3*@afn1(theta) + @afn1(3*theta+#pi/2*@b) - @afn1(#pi/2*@b)
af2 = 3*@afn2(theta) + @afn2(3*theta+#pi/2*@b) - @afn2(#pi/2*@b)
polar = 0.35*@a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 31) ; smallest Ellipse Catacaustic
theta = atan(imag(#z)/real(#z))
af1 = 4*@a*(@a-@b)*(@a*@b)*sin(theta)^3/(@a^2+@b^2+(@b^2-@a^2)*cos(2*theta))
af2 = 4*@b*(@b^2-@a^2)*cos(theta)^3/(@a^2+@b^2+3*(@b^2-@a^2)*cos(2*theta))
polar = 0.25*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 32) ; smallest Log Spiral Catacaustic
theta = atan(imag(#z)/real(#z))
af1 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)-sin(theta))/(1+(2*@b^2))
af2 = 2*@b*exp(2*@b*theta)*(2*@b*cos(theta)+sin(theta))/(1+(2*@b^2))
polar = @a*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 33) ; smallest Butterfly Distance
theta = atan(imag(#z)/real(#z))
r = 1.25*@a*(exp(sin(theta))-2*cos(4*theta)+sin(1/24*(2*theta-#pi)))
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 34) ; smallest Gear Curve
theta = atan(imag(#z)/real(#z))
af1 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*cos(theta)
af2 = (0.25*@a+1/@b*tanh(@b*sin(@pn*theta)))*sin(theta)
polar = (af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 35) ; smallest Arachnida 1 Distance
theta = atan(imag(#z)/real(#z))
r = @a*sin(@pn*theta)/sin((@pn-1)*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 36) ; smallest Arachnida 2 Distance
theta = atan(imag(#z)/real(#z))
r = @a*sin(@pn*theta)/sin((@pn+1)*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 37) ; smallest Cayley's Sextic Distance
theta = atan(imag(#z)/real(#z))
r = 1.5*@a*cos(theta)^3
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 38) ; smallest Cycloid of Seva Distance
theta = atan(imag(#z)/real(#z))
r = 0.5*@a*(1+2*cos(2*theta))
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 39) ; smallest Devil's Curve Distance
theta = atan(imag(#z)/real(#z))
r = (((0.5*@a*sin(theta))^2-(0.2*@b*cos(theta))^2)/(sin(theta)^2-cos(theta)^2))^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 40) ; smallest Eight Curve Distance
theta = atan(imag(#z)/real(#z))
r = @a*cos(theta)^(-2)*cos(2*theta)^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 41) ; smallest Epispiral Distance
theta = atan(imag(#z)/real(#z))
r = 0.25*@a/cos(@pn*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 42) ; smallest Hipopede Distance
theta = atan(imag(#z)/real(#z))
r = (0.5*@b*(0.5*@a-(0.5*@b)^2*cos(theta)))^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 43) ; smallest Maltese Cross Distance
theta = atan(imag(#z)/real(#z))
r = 0.5*@a/(cos(theta)*sin(theta)*(cos(theta)^2-sin(theta)^2))^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 44) ; smallest Ophiuride Distance
theta = atan(imag(#z)/real(#z))
r = (0.01*@b*sin(theta)-4.5*@a*cos(theta))*tan(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 45) ; smallest Quadratrix of
Hippias Distance
theta = atan(imag(#z)/real(#z))
r = @a*theta/sin(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 46) ; smallest Poinsot Spiral 1 Distance
theta = atan(imag(#z)/real(#z))
r = 1.5*@a/cosh(@pn*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 47) ; smallest Poinsot Spiral 2 Distance
theta = atan(imag(#z)/real(#z))
r = @a/sinh(@pn*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 48) ; smallest Quadrifolium Distance
theta = atan(imag(#z)/real(#z))
r = 2.5*@a*sin(2*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 49) ; smallest Scarabaeus Distance
theta = atan(imag(#z)/real(#z))
r = 0.5*@b*cos(2*theta)-@a*cos(theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 50) ; smallest Semicubical
Parabola Distance
theta = atan(imag(#z)/real(#z))
r = 1.5*@a*(cos(3*@b*theta))^(1/(3*@b))
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 51) ; smallest Swastika Curve Distance
theta = atan(imag(#z)/real(#z))
r = 2.25*@a*(sin(theta)*cos(theta)/(sin(theta)^4-cos(theta)^4))^0.5
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 52) ; smallest Trifolium Distance
theta = atan(imag(#z)/real(#z))
r = -2*@a*cos(3*theta)
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 53) ; smallest Tschirnhausen
Cubic Distance
theta = atan(imag(#z)/real(#z))
r = @a/cos(theta/3)^3
polar = r*cos(theta) + flip(r*sin(theta))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 54) ; smallest Bicorn
theta = atan(imag(#z)/real(#z))
af1 = @a*sin(theta)
af2 = @a*cos(theta)^2*(2+cos(theta))/(3+sin(theta)^2)
polar = 1.5*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 55) ; smallest Cruciform
theta = atan(imag(#z)/real(#z))
af1 = 0.1*@a/cos(theta)
af2 = 0.02*@b/sin(theta)
polar = 1.5*(af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 56) ; smallest Knot curve
cy = imag(#z)
qa = 1
qb = -2
qc = 1 - 3*cy^2 - 2*cy^3
if @negroot == true
qx = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qx = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
polar = @a*(qx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 57) ; smallest Ampersand
qa = 4
qb = 6*real(#z)^2 - 3*real(#z) - 3
qc = 6*real(#z)^4 - 13*real(#z)^3 + 19*real(#z)^2
if @negroot == true
qy = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qy = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
polar = @a*(real(#z) + flip(qy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 58) ; smallest Bean
theta = atan(imag(#z)/real(#z))
af1 = @a*(@afn1(theta)^real(@apwr) + @afn2(theta)^imag(@apwr))
polar = ((af1*cos(theta))+flip((af1*sin(theta))))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 59) ; smallest Bicuspid
cy = imag(#z)
qa = 1
qb = -2*(0.05*@b)^2
qc = (0.05*@b)^4 - (cy^2 - (0.05*@b)^2)^2
if @negroot == true
qx = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qx = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
polar = 2.25*@a*(qx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 60) ; smallest Bow
theta = atan(imag(#z)/real(#z))
af1 = 0.1*@a*(1-tan(theta)^2)*cos(theta)
af2 = 0.1*@b*(1-tan(theta)^2)*sin(theta)
polar = (af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 61) ; smallest Cassini Ovals
theta = atan(imag(#z)/real(#z))
if @negroot == true
rr = 0.5*@a*(cos(2*theta)-((@b*0.1/(@a*0.5))^4-sin(2*theta)^2)^0.5)^0.5
else
rr = 0.5*@a*(cos(2*theta)+((@b*0.1/(@a*0.5))^4-sin(2*theta)^2)^0.5)^0.5
endif
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 62) ; smallest Circle
theta = atan(imag(#z)/real(#z))
rr = @a*sin(theta)^2 + 0.2*@b*cos(theta)^2
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 63) ; smallest Trident
cx = real(#z)
cy = cx^2 + 0.1*@b/cx
polar = 0.1*@a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 64) ; smallest Stirrup Curve
cy = imag(#z)
qa = 1
qb = -2
qc = 1-cy^2*(cy-1)*(cy-2)*(cy+5)
if @negroot == true
qx = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qx = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
polar = @a*(qx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 65) ; smallest Diamond
polar = @a*@safn(abs((real(#z)*@sa1))+abs((flip(imag(#z))^@sa2))-1)
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 66) ; smallest Dumbbell Curve
cx = real(#z)
cy = (cx^4 - cx^6)^0.5
polar = 4*@a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 67) ; smallest Teardrop Curve
theta = atan(imag(#z)/real(#z))
af1 = @a*cos(theta)
af2 = 0.5*@b*sin(theta)*sin(theta/2)^(@pn-1)
polar = (af1 + flip(af2))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 68) ; smallest Happy Accident
polar = 15*@a*@safn((((real(#z)*@sa4)^(1+@sa2))+ \
(flip(imag(#z))^2*@sa3))*atan2((flip(imag(#z))^@sa7)* \
(real(#z)^@sa5))-@sa1* \
(flip(imag(#z))^@sa6))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 69) ; smallest Hyperbola
theta = atan(imag(#z)/real(#z))
rr = 0.35*@a*(1/cos(2*theta))^0.5
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 70) ; smallest Kappa Curve
theta = atan(imag(#z)/real(#z))
rr = 0.1*@a*tan(theta)
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 71) ; smallest Piriform
theta = atan(imag(#z)/real(#z))
af1 = 0.1*@a*(1+sin(theta))
af2 = 0.1*@b*cos(theta)*(1+sin(theta))
polar = af1 + flip(af2)
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 72) ; smallest Keratoid Cusp
cx = real(#z)
qa = 1
qb = -cx^2
qc = -cx^5
if @negroot == true
qy = (-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa)
else
qy = (-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa)
endif
polar = 2.5*@a*(cx + flip(qy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 73) ; smallest Serpentine Curve
theta = atan(imag(#z)/real(#z))
af1 = 0.2*@a*cotan(theta)
af2 = 0.2*@b*sin(theta)*cos(theta)
polar = af1 + flip(af2)
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 74) ; smallest Line
cx = real(#z)
cy = cx
polar = 3*@a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 75) ; smallest Links Curve
cx = real(#z)
qa = 1
qb = 2*cx^2-6*cx
qc = cx^4-2*cx^3+cx^2
if @negroot == true
qy = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qy = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
polar = @a*(cx + flip(qy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 76) ; smallest Parabola
cy = imag(#z)
cx = 10*@b*cy^2
polar = 0.65*@a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 77) ; smallest Trefoil
theta = atan(imag(#z)/real(#z))
rr = 0.1*@a/cos(3*theta)
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 78) ; smallest Trident of Descartes
cx = real(#z)
cy = (cx-0.2*@b)*(cx+0.2*@b)*(cx-0.4*@b)/cx
polar = @a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 79) ; smallest Trisectrix of Maclaurin
theta = atan(imag(#z)/real(#z))
rr = 0.5*@a*sin(3*theta)/sin(2*theta)
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 80) ; smallest Atzema Spiral
theta = atan(imag(#z)/real(#z))
af1 = 0.5*@a*(sin(theta)/theta-2*cos(theta)-theta*sin(theta))
af2 = 0.05*@b*(cos(theta)/theta-2*sin(theta)+theta*cos(theta))
polar = af1 + flip(af2)
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 81) ; smallest Rose of Troy
theta = atan(imag(#z)/real(#z))
rr = @cp*(1+10*@a*sin(4*@b*theta))
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 82) ; smallest Cotes' Spiral
theta = atan(imag(#z)/real(#z))
rr = @a/cosh(@b*theta)
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 83) ; smallest Dipole Curve
theta = atan(imag(#z)/real(#z))
rr = @a*(cos(theta))^0.5
polar = (rr*cos(theta))+flip((rr*sin(theta)))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
elseif (@zmode == 84) ; smallest Polytrope
cx = real(#z)
cy = 1/cx^@pn
polar = 0.00005*@a*(cx + flip(cy))
d1 = abs(cabs(z1)-cabs(polar)) ; get current distances
d2 = abs(cabs(z2)-cabs(polar))
d3 = abs(cabs(z3)-cabs(polar))
if (d1 < s1) ; update smallest distances
s1 = d1
endif
if (d2 < s2)
s2 = d2
endif
if (d3 < s3)
s3 = d3
endif
endif

if ( @bailout < |z1|+|z2|+|z3| ||\
@everyiter ||\
done == #maxiter + 2); done, or every iteration, or last
; determine continuous iteration (height) for each point
if (@zmode >= 0 && @zmode <= 84) ; height based on smallest |z|
e1 = s1 * @zscale
e2 = s2 * @zscale
e3 = s3 * @zscale
elseif (@zmode == 85)
e1 = iterexp1 * @zscale
e2 = iterexp2 * @zscale
e3 = iterexp3 * @zscale
endif

; apply transfer function
; a function is not used because these are floats
; and not all functions apply to floats
if (@xfer == 1); log
e1 = log(e1)
e2 = log(e2)
e3 = log(e3)
elseif (@xfer == 2); sqrt
e1 = sqrt(e1)
e2 = sqrt(e2)
e3 = sqrt(e3)
elseif (@xfer == 3); cuberoot
e1 = (e1)^(1/3)
e2 = (e2)^(1/3)
e3 = (e3)^(1/3)
elseif (@xfer == 4); exp
e1 = exp(e1)
e2 = exp(e2)
e3 = exp(e3)
elseif (@xfer == 5); sqr
e1 = sqr(e1)
e2 = sqr(e2)
e3 = sqr(e3)
elseif (@xfer == 6); cube
e1 = (e1)^3
e2 = (e2)^3
e3 = (e3)^3
elseif (@xfer == 7); sin
e1 = sin(e1)
e2 = sin(e2)
e3 = sin(e3)
elseif (@xfer == 8); cos
e1 = cos(e1)
e2 = cos(e2)
e3 = cos(e3)
elseif (@xfer == 9); tan
e1 = tan(e1)
e2 = tan(e2)
e3 = tan(e3)
endif

; apply post-scale
e1 = e1 * @zscale2
e2 = e2 * @zscale2
e3 = e3 * @zscale2

vx = e2-e1
vy = e3-e1
vz = -@offset
; normalize vector
vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz))
vx = vx*vd
vy = vy*vd
vz = vz*vd
z = vx + flip(vy); fudge z from vector
else; didn't compute z this time
z = z1; use primary iteration value to keep periodicity working
endif
else
z = z1
endif
if ( @bailout < |z1|+|z2|+|z3| ) ; we're done
done = 0
endif

iter=iter+1

Bailout:

done > 0

Default:

Heading
caption="Parameters"
Endheading

Heading
caption="Functions"
Endheading

Heading
caption="Slope Parameters"
visible=@slope==true
Endheading
bool param slope
caption="Apply slope?"
default=true
endparam
float param offset
caption="Orbit Separation"
default=0.00000001
hint="Defines how far apart the simultaneous orbits are. Smaller \
distances will produce more accurate results."
visible=@slope==true
endparam
param zmode
caption="Height Value"
default=85
enum="smallest |z|""smallest |real(z)|""smallest |imag(z)|"
\
"smallest summ(z)""smallest |atan(z)|""smallest |function1|"
\
"smallest
|function2|""Lemniscate""Cardioid""Conchoid""Cycloid" \
"Archimedes""Log Spiral""Rose""Bifolium""Astroid""Cissoid of
Diocles" \
"Cochleoid""Folium of Descartes""Limacon of
Pascal""Lituus""Nephroid" \
"Strophoid""Witch of Agnesi""Curtate
Cycloid""Epicycloid""Ellipse Evolute" \
"Tractrix""Kampyle of Eudoxus""Circle Catacaustic""Deltoid
Catacaustic" \
"Ellipse Catacaustic""Log Spiral Catacaustic""Butterfly""Gear
Curve" \
"Arachnida 1""Arachnida 2""Cayley's Sectic""Cycloid of Seva"
"Devil's Curve" \
"Eight Curve""Epispiral""Hipopede""Maltese Cross""Ophiuride"
\
"Quadratrix of Hippias""Poinsot Spiral 1""Poinsot Spiral
2""Quadrifolium" \
"Scarabaeus""Semicubical Parabola""Swastika Curve"
\
"Trifolium""Tschirnhausen Cubic""Bicorn""Cruciform""Knot
Curve""Ampersand" \
"Bean""Bicuspid""Bow""Cassini Ovals""Circle""Trident""Stirrup
Curve""Diamond"\
"Dumbbell Curve""Teardrop Curve""Happy
Accident""Hyperbola""Kappa Curve" \
"Piriform""Keratoid Cusp""Serpentine Curve""Line""Links
Curve""Parabola" \
"Trefoil""Trident of Descartes""Trisectrix of
Maclaurin""Atzema Spiral" \
"Rose of Troy""Cotes' Spiral""Dipole
Curve""Polytrope""smoothed iteration"
hint="Specifies what will be used to construct a height value."
visible=@slope==true
endparam
func fnsl
caption="Transmute Function"
default=ident()
visible=(@zmode==5)||(@zmode==6)&&(@slope==true)
endfunc
param a
caption="Polar Parameter 1"
default=3.0
visible=(@zmode==7)||(@zmode==8)||(@zmode==9)||(@zmode==10) || \
(@zmode==11)||(@zmode==12)||(@zmode==13)||(@zmode==14) || \
(@zmode==15)||(@zmode==16)||(@zmode==17)||(@zmode==18) || \
(@zmode==19)||(@zmode==20)||(@zmode==21)||(@zmode==22) || \
(@zmode==23)||(@zmode==24)||(@zmode==25)||(@zmode==26) || \
(@zmode==27)||(@zmode==28)||(@zmode==29)||(@zmode==30) || \
(@zmode==31)||(@zmode==32)||(@zmode==33)||(@zmode==34) || \
(@zmode==35)||(@zmode==36)||(@zmode==37)||(@zmode==38) || \
(@zmode==39)||(@zmode==40)||(@zmode==41)||(@zmode==42) || \
(@zmode==43)||(@zmode==44)||(@zmode==45)||(@zmode==46) || \
(@zmode==47)||(@zmode==48)||(@zmode==49)||(@zmode==50) || \
(@zmode==51)||(@zmode==52)||(@zmode==53)||(@zmode==53) || \
(@zmode==54)||(@zmode==55)||(@zmode==56)||(@zmode==57) || \
(@zmode==58)||(@zmode==59)||(@zmode==60)||(@zmode==61) || \
(@zmode==62)||(@zmode==63)||(@zmode==64)||(@zmode==65) || \
(@zmode==66)||(@zmode==67)||(@zmode==68)||(@zmode==69) || \
(@zmode==70)||(@zmode==71)||(@zmode==72)||(@zmode==73) || \
(@zmode==74)||(@zmode==75)||(@zmode==76)||(@zmode==77) || \
(@zmode==78)||(@zmode==79)||(@zmode==80)||(@zmode==81) || \
(@zmode==82)||(@zmode==83)||(@zmode==84)&&(@slope==true)
endparam
param b
caption="Polar Parameter 2"
default=3.0
visible=(@zmode==9)||(@zmode==19)||(@zmode==22)||(@zmode==24) || \
(@zmode==25)||(@zmode==26)||(@zmode==29)||(@zmode==30) || \
(@zmode==31)||(@zmode==32)||(@zmode==34)||(@zmode==39) || \
(@zmode==42)||(@zmode==44)||(@zmode==49)||(@zmode==50) || \
(@zmode==55)||(@zmode==59)||(@zmode==60)||(@zmode==61) || \
(@zmode==62)||(@zmode==63)||(@zmode==67)||(@zmode==71) || \
(@zmode==73)||(@zmode==76)||(@zmode==78)||(@zmode==80) || \
(@zmode==81)||(@zmode==82)&&(@slope==true)
endparam
param cp
caption="3rd Polar parameter"
default=0.05
visible=(@zmode==81)&&(@slope==true)
endparam
param pn
caption="Polar Integer"
default=3
visible=(@zmode==34)||(@zmode==35)||(@zmode==36)||(@zmode==47) || \
(@zmode==84)&&(@slope==true)
endparam
param apwr
caption="Polar Power"
default=(3.0,3.0)
visible=(@zmode==15)||(@zmode==26)||(@zmode==58)&&(@slope==true)
endparam
func afn1
caption="Polar Fn 1"
default=cos()
visible=(@zmode==15)||(@zmode==21)||(@zmode==24)||(@zmode==25) || \
(@zmode==26)||(@zmode==27)||(@zmode==30)||(@zmode==58) && \
(@slope==true)
endfunc
func afn2
caption="Polar Fn 2"
default=sin()
visible=(@zmode==15)||(@zmode==21)||(@zmode==24)||(@zmode==25) || \
(@zmode==26)||(@zmode==27)||(@zmode==30)||(@zmode==58) && \
(@slope==true)
endfunc
param sa1
caption="Adjuster 1"
default=1.0
visible=(@zmode==65)||(@zmode==68)&&(@slope==true)
endparam
param sa2
caption="Adjuster 2"
default=1.0
visible=(@zmode==65)||(@zmode==68)&&(@slope==true)
endparam
param sa3
caption="Adjuster 3"
default=1.0
visible=(@zmode==68)&&(@slope==true)
endparam
param sa4
caption="Adjuster 4"
default=1.0
visible=(@zmode==68)&&(@slope==true)
endparam
param sa5
caption="Adjuster 5"
default=1.0
visible=(@zmode==68)&&(@slope==true)
endparam
param sa6
caption="Adjuster 6"
default=1.0
visible=(@zmode==68)&&(@slope==true)
endparam
param sa7
caption="Adjuster 7"
default=1.0
visible=(@zmode==68)&&(@slope==true)
endparam
func safn
caption="Adjuster Fn"
default=ident()
visible=(@zmode==65)||(@zmode==68)&&(@slope==true)
endfunc
param negroot
caption = "Quad Neg Root"
default = false
visible=(@zmode==56)||(@zmode==57)||(@zmode==59)||(@zmode==61) || \
(@zmode==64)||(@zmode==72)||(@zmode==75)&&(@slope==true)
endparam
param xfer
caption="Height Transfer"
default=0
enum="linear""log""sqrt""cuberoot""exp""sqr""cube""sin""cos""tan"
hint="This function will be applied to the height value \
before a slope is calculated."
visible=@slope==true
endparam
param zscale
caption="Height Pre-Scale"
default=1.0
hint="Specifies the ratio between height and distance. Higher \
values will exaggerate differences between high and low. \
In general, you will want to use smaller numbers here."
visible=@slope==true
endparam
param zscale2
caption="Height Post-Scale"
default=0.01
hint="Specifies the ratio between height and distance; like \
Height Pre-Scale, except that this value is applied after \
the transfer function."
visible=@slope==true
endparam
param everyiter
caption="Every Iteration"
default=false
hint="If set, the surface normal will be computed at every \
iteration. If you are using a coloring algorithm which \
processes every iteration, you will need this."
visible=@slope==true
endparam

Param version
caption = "Version"
default= 1.0
visible = false
Endparam

}

2009/10/5 Andrea Spinozzi <andrea....@gmail.com>:

Andrea Spinozzi

unread,
Oct 4, 2009, 8:24:26 PM10/4/09
to UFB...@googlegroups.com
arghhhh errors on the pasted code i attach the formula on the e.mail....sorry.
Again Andrea

2009/10/5 Andrea Spinozzi <andrea....@gmail.com>:

SlopeDivideJulibrot.ufm

GillesNadeau

unread,
Oct 14, 2009, 5:53:08 AM10/14/09
to ufb...@googlegroups.com
Hi Andrea,

I love this version. It is a very interesting formula. I enjoy playing with
it.

Gilles
--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.14.3/2414 - Release Date: 10/04/09
18:42:00

Reply all
Reply to author
Forward
0 new messages