reb
Class REB_Inversions
Object
common:Generic
common:Transform
common:UserTransform
reb:REB_Inversions
class
- UserTransform:REB_Inversions
Circle Inversions transform.
Ultra Fractal Source
Toggle UF Source Code Display
class REB_Inversions(common.ulb:UserTransform) {
; Circle Inversions transform. <br>
public:
import "common.ulb"
; constructor
func REB_Inversions(Generic pparent)
UserTransform.UserTransform(pparent)
i = new @isph(0)
i.recurse()
cir = i.s
max = i.fk
endfunc
; initialize the object
func Init(complex pz)
UserTransform.Init(pz)
if !@itertx
iii = 0
c1 = 0
z3 = pz
z4 = 0
pz = 0
width = 0
scale = 0
z2 = 0
x1 = 0
y1 = 0
beta = 0
theta1 = 0
x2 = 0
radius = 0
zrot = (0,1)^(#angle*2/#pi)
while iii < max
radius = cir.sph[iii].frad
if ((@showbase || (radius < i.bradius ) &&(!i.circles || \
i.circles && ((!i.showc && radius != i.crad) || i.showc))) && radius > 0)
c1 = cir.sph[iii].fcen*@scle/#magn*zrot
width = radius*@scle/(#magn*@rad)
scale = 2/(@scale*width)
complex z2 = (z3-c1)*scale
x1 = cabs(z2)/(width*scale)
if x1 < 1
; refraction calcs
theta1 = acos(x1)
y1=sin(theta1)
beta = asin(x1/@n)
x2 = -y1/real(tan(theta1+beta))+ x1
; move pixel
z4 = (z2/x1 * x2)*2/(@scale)
pz = z4
endif
endif
iii = iii + 1
endwhile
endif
endfunc
; call for each iterated point
complex func Iterate(complex pz)
UserTransform.Iterate(pz)
if @itertx
iii = 0
c1 = 0
z3 = pz
z4 = 0
pz = 0
width = 0
scale = 0
z2 = 0
x1 = 0
y1 = 0
beta = 0
theta1 = 0
x2 = 0
radius = 0
zrot = (0,1)^(#angle*2/#pi)
while iii < max
radius = cir.sph[iii].frad
if ((@showbase || (radius < i.bradius ) &&(!i.circles || \
i.circles && ((!i.showc && radius != i.crad) || i.showc))) && radius > 0)
c1 = cir.sph[iii].fcen*@scle/#magn*zrot
width = radius*@scle/(#magn*@rad)
scale = 2/(@scale*width)
complex z2 = (z3-c1)*scale
x1 = cabs(z2)/(width*scale)
if x1 < 1
; refraction calcs
theta1 = acos(x1)
y1=sin(theta1)
beta = asin(x1/@n)
x2 = -y1/real(tan(theta1+beta))+ x1
; move pixel
z4 = (z2/x1 * x2)*2/(@scale)
pz = z4
endif
endif
iii = iii + 1
endwhile
endif
if pz != 0
pz = z4
else
m_solid = true
endif
return pz
endfunc
protected:
int iii
complex c1
complex z2
complex z3
complex z4
float width
float scale
float x1
float y1
float beta
float theta1
float x2
float radius
complex zrot
spherearray cir
int max
InvertSphere i
default:
title = "Circle Inversions"
int param v_circleinversions
caption = "Version (Circle Inversions)"
default = 102
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_circleinversions < 102
endparam
heading
text = "Iterates the transform initialization for each iterated value of the \
pixel. May give very interesting effects but may dramatically slow \
the transform."
visible = @itertx
endheading
param itertx
caption = "Iterate transform"
default = false
endparam
bool param showbase
caption = "Show Base Set"
default = false
endparam
InvertSphere param isph
caption = "Invert Circles"
default = InvertCircles
selectable = false
endparam
heading
caption = "Display Parameters"
endheading
param n
caption = "Refractive index"
default = 1.5
hint = "Refactive index of 'glass'"
endparam
float param scale
caption = "Fractal zoom"
default = 1.0
endparam
float param scle
caption = "Object magnification"
default = 1.5
endparam
float param rad
caption = "radius adjustment"
default = 1.0
endparam
}
Methods inherited from class Object |
|
REB_Inversions
public REB_Inversions(Generic pparent)
- constructor
REB_Inversions
public REB_Inversions()
Init
public void Init(complex pz)
- initialize the object
- Overrides:
Init
in class Transform
- Parameters:
pz
- the value representing the sequence; for a normal transformation formula use, this will be #pixel. In some cases this may differ from the first value passed to Iterate() if the calling code applies some other transformations.
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