reb
Class AppolonianGasket
Object
common:Generic
common:Transform
common:UserTransform
reb:AppolonianGasket
class
- UserTransform:AppolonianGasket
Modified from Morgan Owens' Fractint frm
Ultra Fractal Source
Toggle UF Source Code Display
class AppolonianGasket(common.ulb:UserTransform) {
; Modified from Morgan Owens' Fractint frm
public:
import "common.ulb"
; constructor
func AppolonianGasket(Generic pparent)
UserTransform.UserTransform(pparent)
ar=@rr1
br=@rr2
cr=@rr3
float ax=real(@cir1)
float ay=imag(@cir1)
float bx=real(@cir2)
float by=imag(@cir2)
float cx=real(@cir3)
float cy=imag(@cir3)
float h=sqr(ax)+ay^2-ar^2
float a=2*(ar-br)
float b=2*(ax-bx)
float c=2*(ay-by)
float d=h-(bx^2+by^2-br^2)
float ee=2*(ar-cr)
float f=2*(ax-cx)
float g=2*(ay-cy)
float h=h-(cx^2+cy^2-cr^2)
float l=(b*g-c*f)
float i=(d*g-c*h)/l
float j=(a*g-c*ee)/l
float k=(b*h-d*f)/l
float l=(b*ee-a*f)/l
float m=2*(1-2*l^2)
float n=2*(cr+(i-cx)*j+(k-cy)*l)
float o=2*(cr^2-(i-cx)^2-(k-cy)^2)
r=sqrt(sqr(n)-m*o)
float r1=(-n-r)/m
float r2=(-n+r)/m
if r1>0
r=r1
else
r=r2
endif
float x=i-j*r
float y=k-l*r
ap=real(ax)+flip(ay)
bp=real(bx)+flip(by)
cp=real(cx)+flip(cy)
p=real(x)+flip(y)
arr=ar^2
brr=br^2
crr=cr^2
rr=r^2
endfunc
; call for each iterated point
complex func Iterate(complex pz)
UserTransform.Iterate(pz)
int ii = 0
complex zz=pz*@scale
while ii < @iter
if(|zz-ap|<arr)
zz=ar*conj(ar/(zz-ap))+ap
elseif(|zz-bp|<brr)
zz=br*conj(br/(zz-bp))+bp
elseif(|zz-cp|<crr)
zz=cr*conj(cr/(zz-cp))+cp
elseif(|zz-p|<rr)
zz=r*conj(r/(zz-p))+p
endif
ii = ii + 1
endwhile
return zz*@scale
endfunc
protected:
float ar
float br
float cr
complex ap
complex bp
complex cp
complex p
float arr
float brr
float crr
float r
float rr
default:
title = "Appolonian Gasket"
int param v_appoloniangasket
caption = "Version (Appolonian Gasket)"
default = 100
hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
visible = @v_appoloniangasket < 100
endparam
param cir1
caption="Circle 1 Coord"
default = (-0.866025,-0.5)
endparam
param rr1
caption="Circle 1 Radius"
default=0.866025
endparam
param cir2
caption="Circle 2 Coord"
default = (0.866025,-0.5)
endparam
param rr2
caption="Circle 2 Radius"
default=0.866025
endparam
param cir3
caption="Circle 3 Coord"
default = (0.0,1.0)
endparam
param rr3
caption="Circle 3 Radius"
default=0.866025
endparam
int param iter
caption = "# Iterations"
default = 10
endparam
float param scale
caption = "Scale"
default = 1.0
endparam
}
Methods inherited from class Object |
|
AppolonianGasket
public AppolonianGasket(Generic pparent)
- constructor
AppolonianGasket
public AppolonianGasket()
Iterate
public complex Iterate(complex pz)
- call for each iterated point
- Overrides:
Iterate
in class Transform
- Parameters:
pz
- the complex value to be transformed
- Returns:
- the transformed value