mmf
Class MMF_LineDeadDLA

Object
  extended by common:Generic
      extended by mmf:MMF_DeadDLA
          extended by mmf:MMF_LineDeadDLA

class 
MMF_DeadDLA:MMF_LineDeadDLA



Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_LineDeadDLA(MMF_DeadDLA) {
 public:
   import "common.ulb"
   ; @param pparent the parent, generally "this" from "DLA Inspired"
   func MMF_LineDeadDLA(Generic pparent)
     m_Parent = pparent
     d2 = sqr(dx=(real(@le)-real(@ls))*#width) \
          + sqr(dy=(imag(@le)-imag(@ls))*#height)
     id2 = 1.0/d2
     float x = real(@ls)*#width + 2
     float y = imag(@ls)*#height + 2
     if abs(dx)>=abs(dy)
       if dx==0
         MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y),@colour,@index)
         MMF_DLA(pparent).SetDeadPoint(floor(x)+1,floor(y),@colour,@index)
         MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y)+1,@colour,@index)
         MMF_DLA(pparent).SetDeadPoint(floor(x)+1,floor(y)+1,@colour,@index)
       elseif dx>0
         float d = dy/dx
         repeat
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y),@colour,@index)
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y)+1,@colour,@index)
           y = y + d
         until (x=x+1)>real(@le)*#width + 2
       else
         float d = -dy/dx
         repeat
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y),@colour,@index)
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y)+1,@colour,@index)
           y = y + d
         until (x=x-1)<real(@le)*#width + 2
       endif
     else
       if dy>0
         float d = dx/dy
         repeat
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y),@colour,@index)
           MMF_DLA(pparent).SetDeadPoint(floor(x)+1,floor(y),@colour,@index)
           x = x + d
         until (y=y+1)>imag(@le)*#height + 2
       else
         float d = -dx/dy
         repeat
           MMF_DLA(pparent).SetDeadPoint(floor(x),floor(y),@colour,@index)
           MMF_DLA(pparent).SetDeadPoint(floor(x)+1,floor(y),@colour,@index)
           x = x + d
         until (y=y-1)<imag(@le)*#height + 2
       endif
     endif
   endfunc
   ; @param x the x pixel position of a stimulus
   ; @param y the y pixel position of a stimulus
   ; @return the square of the pixel distance
   float func DeadDistance(float x,float y)
     float u
     x = x - real(@ls)*#width - 2
     y = y - imag(@ls)*#height - 2
     u = x*dx + y*dy
     if u<0
       return sqr(x) + sqr(y)
     elseif u>d2
       return sqr(x - dx) + sqr(y - dy)
     else
       return sqr(y*dx - x*dy)*id2
     endif
   endfunc
 private:
   float d2
   float id2
   float dx
   float dy
 default:
   title = "Dead Line"
   complex param ls
     caption = "Line Start"
     default = (0.25,0.25)
     hint = "The start point of the dead line. The real part is the fraction \
             across the screen and the imaginary part is the fraction down \
             the screen. Both real and imaginary parts should be \
             >=0 and <=1."
   endparam
   complex param le
     caption = "Line End"
     default = (0.25,0.75)
     hint = "The end point of the dead line. The real part is the fraction \
             across the screen and the imaginary part is the fraction down \
             the screen. Both real and imaginary parts should be \
             >=0 and <=1."
   endparam
 }
 


Constructor Summary
MMF_LineDeadDLA()
           
MMF_LineDeadDLA(Generic pparent)
           
 
Method Summary
 float DeadDistance(float x, float y)
           
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_LineDeadDLA

public MMF_LineDeadDLA(Generic pparent)
Parameters:
pparent - the parent, generally "this" from "DLA Inspired"

MMF_LineDeadDLA

public MMF_LineDeadDLA()
Method Detail

DeadDistance

public float DeadDistance(float x,
                          float y)
Overrides:
DeadDistance in class MMF_DeadDLA
Parameters:
x - the x pixel position of a stimulus
y - the y pixel position of a stimulus
Returns:
the square of the pixel distance