Class InvertCube(InvertSphere) {
; sphere inversions starting with a cubic geometery <br>
; this is a child of InvertSphere
public:
import "common.ulb"
; constructor for sphere inversions with a cubic geometry
func InvertCube(Generic pparent)
InvertSphere.InvertSphere(0)
fscle = 3 + sqrt(3), fbaserad = sqrt(6)+sqrt(2)
scale = 0.34, fii = 7, fjj = 9, fks = 8, fk = fks, rlevel = 25
initSpheres()
endfunc
; Initializes base and generator spheres
func InitSpheres()
complex Fc[16]
float Fz[16]
float Fr[16]
int i = 0
complex grot = exp(flip(1)*#pi/2)
while i < 4
Fc[i] = (1,0)*grot^i*fscle
Fz[i] = 0
Fr[i] = fbaserad
i = i + 1
endwhile
Fc[4] = Fc[5] = Fc[6] = (0,0)
Fz[4] = fscle
Fz[5] = -fscle
Fz[6] = 0
Fr[4] = Fr[5] = fbaserad
Fr[6] = sqrt(2)
i = 7
while i < 15
Fc[i] = (1,1)*grot^(i-7)
if i < 11
Fz[i] = 1
else
Fz[i] = -1
endif
Fr[i] = 1
i = i + 1
endwhile
Fc[i] = (0,0)
Fz[i] = 0
Fr[i] = 1+sqrt(3)
; scale and translate the spheres to screen dimensions
;
i = 0
repeat
if reflect
Fc[i] = -conj(Fc[i])
else
Fc[i] = Fc[i]
endif
; Z axis rotation
Fc[i] = Fc[i]*zrot
; Y axis rotation
temp = real(Fc[i]) + flip(Fz[i])
temp = temp*yrot
Fc[i] = real(temp) + flip(imag(Fc[i]))
Fz[i] = imag(temp)
; X axis rotation
temp = imag(Fc[i]) + flip(Fz[i])
temp = temp*xrot
Fc[i] = real(Fc[i]) + flip(real(temp))
Fz[i] = imag(temp)
; scaling
Fc[i] = Fc[i]*#magn*scale
Fz[i] = Fz[i]*#magn*scale
if i > 6
Fr[i] = Fr[i]*#magn*scale*@bradadj
else
Fr[i] = Fr[i]*#magn*scale*@radadj
endif
i = i+1
until i == 16
; declare the generator spheres
;
; cube
i = 0
while i < 7
fg[i] = new Sphere(Fc[i],Fz[i],Fr[i],0,i)
i = i + 1
endwhile
;
; declare the base Spheres
;
; cube
while i < 16
fb[i-7] = new Sphere(Fc[i],Fz[i],Fr[i],0,i-7)
i = i + 1
endwhile
bradius = fb[0].frad
i = 0
while i < 8
s.sph[i] = fb[i]
i = i + 1
endwhile
endfunc
default:
title = "Cube"
int param v_cube
caption = "Version (Cube)"
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_cube < 100
endparam
}