reb
Class REB_Mobius

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by reb:REB_Mobius

class 
UserTransform:REB_Mobius

Kleinian Inversions.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_Mobius(common.ulb:UserTransform) {
  ; Kleinian Inversions. <br>
  ;
  public:
    import "common.ulb"
 
    ; constructor
    func REB_Mobius(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
 
    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 = "Kleinian Inversions"
   int param v_kleinianinversions
     caption = "Version (Kleinian 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_kleinianinversions < 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
     visible = false
   endparam
   InvertSphere param isph
     caption = "Kleinian"
     default = InvertMobius
     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 = 2.0
   endparam
   float param rad
     caption = "radius adjustment"
     default = 1.0
   endparam
  }
 


Constructor Summary
REB_Mobius()
           
REB_Mobius(Generic pparent)
          constructor
 
Method Summary
 void Init(complex pz)
          initialize the object
 complex Iterate(complex pz)
          Transform a single point within a sequence
 
Methods inherited from class common:Transform
IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

REB_Mobius

public REB_Mobius(Generic pparent)
constructor


REB_Mobius

public REB_Mobius()
Method Detail

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)
Description copied from class: Transform
Transform a single point within a sequence

After a sequence has been set up with Init(), this function will be called once for each value in the sequence. Note that all values in the sequence must be processed in order (they cannot be processed out of order). If the sequence contains only one value, Init() will still be called and then Iterate() will be called just once.

Overrides:
Iterate in class Transform
Parameters:
pz - the complex value to be transformed
Returns:
the transformed value