Standard
Class Standard_Clipping

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:ClipShape
              extended by Standard:Standard_Clipping

class 
ClipShape:Standard_Clipping

Object version of Clipping in Standard.uxf. Needs to be combined with Generic Clipping instead of Generic Transformation. Clips the fractal to regular shapes, such as rectangles and circles. It's quite easy to use in combination with the eyedropper. Originally written by Damien M. Jones.


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_Clipping(common.ulb:ClipShape) {
 ;
 ; Object version of Clipping in Standard.uxf. Needs to be combined with
 ; Generic Clipping instead of Generic Transformation.
 ;
 ; Clips the fractal to regular shapes, such as rectangles and circles. It's
 ; quite easy to use in combination with the eyedropper.
 ;
 ; Originally written by Damien M. Jones.
 ;
 public:
   complex func Iterate(complex pz)
     complex r
     float re
 
     ; determine right edge
     if @rotation
       re = cabs(@sciright-@scicenter)
       r = conj(@sciright-@scicenter) / re
     else
       r = conj(exp(flip(#angle)))
       re = abs(real((@sciright-@scicenter)*r))
     endif
 
     ; determine top edge
     float te = abs(imag((@scitop-@scicenter)*r))
 
     ; see if point is inside clipping shape
     complex p = (pz-@scicenter) * r
 
     if @scishape == "circle"
       m_Solid = |p| < sqr(re)
     elseif @scishape == "ellipse"
       m_Solid = sqr(real(p))/sqr(re)+sqr(imag(p))/sqr(te) < 1.0
     elseif @scishape == "square"
       m_Solid = abs(real(p)) < re && abs(imag(p)) < re
     else ; "rectangle"
       m_Solid = abs(real(p)) < re && abs(imag(p)) < te
     endif
     return pz
   endfunc
   
   func SetHandles(Handles phandles)
     ClipShape.setHandles(phandles)
     phandles.SetHandleCount(3, 0, 0, 0)
     phandles.SetHandlePoint(0, 1, -34279628, 0, @scicenter, 0) ; "CENTR"
     phandles.SetHandlePoint(1, 1, -72923950, 0, @sciright, 0)  ; "RIGHT"
     phandles.SetHandlePoint(2, 1, -49026, 0, @scitop, 0)       ; "TOP"
   endfunc
 
 default:
   title = "Clipping"
   helpfile = "Uf*.chm"
   helptopic = "Html/transformations/standard/clipping.html"
   param scicenter
     caption = "Center"
     default = (0,0)
     hint = "Sets the center of clipping."
   endparam
   param sciright
     caption = "Right Edge"
     default = (1,0)
     hint = "Sets the right edge of the clipping shape. If \
             rotation is enabled, sets the center of the \
       right edge."
   endparam
   param scitop
     caption = "Top Edge"
     default = (0,-1)
     hint = "Sets the top edge of the clipping shape. Has no \
             effect for Circle and Square clipping shapes."
   endparam
   param scishape
     caption = "Shape"
     default = 2
     enum = "circle" "ellipse" "square" "rectangle"
     hint = "Selects the clipping shape."
   endparam
   param rotation
     caption = "Allow Rotation"
     default = false
     hint = "If enabled, you can use the Right Edge setting \
             to also select a rotation for the clipping shape."
   endparam
 }
 


Constructor Summary
Standard_Clipping()
           
 
Method Summary
 complex Iterate(complex pz)
          Transform a single point within a sequence
 void SetHandles(Handles phandles)
           
 
Methods inherited from class common:ClipShape
SetAspect
 
Methods inherited from class common:Transform
Init, IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Standard_Clipping

public Standard_Clipping()
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

SetHandles

public void SetHandles(Handles phandles)
Overrides:
SetHandles in class ClipShape