mt
Class MT_GravitationalLens

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by mt:MT_GravitationalLens

class 
UserTransform:MT_GravitationalLens

Mark Townsend, May 2008


Ultra Fractal Source

Toggle UF Source Code Display

 class MT_GravitationalLens(common.ulb:UserTransform) {
 ;
 ; Mark Townsend, May 2008
 ;
 public:
   func MT_GravitationalLens(Generic pparent)
     UserTransform.UserTransform(pparent)
   endfunc
   
   complex func Iterate(complex pz)
     m_Iterations = m_Iterations + 1
     w = pz - @center
     float r = cabs(w)
     float theta = atan2(w)
     if theta < 0
       theta = theta + 2 * #pi
     endif
     r = r - @a * @a / r
     float x = r * cos(theta)
     float y = r * sin(theta)
     return x + flip(y) + @center
   endfunc
 
 default:
   title = "Gravitational Lens"
   param center
     caption = "Center"
     default = (-.5,.5)
   endparam
   param a
     caption = "Einstein radius"
     default = 1.0
   endparam
 }
 


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

Constructor Detail

MT_GravitationalLens

public MT_GravitationalLens(Generic pparent)

MT_GravitationalLens

public MT_GravitationalLens()
Method Detail

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