Standard
Class Standard_Ripples
Object
common:Generic
common:Transform
common:UserTransform
Standard:Standard_Ripples
class
- UserTransform:Standard_Ripples
Object version of Ripples in Standard.uxf.
Adds water ripples to a fractal. Add multiple transforms
for interference effects.
Originally written by Damien M. Jones.
Ultra Fractal Source
Toggle UF Source Code Display
class Standard_Ripples(common.ulb:UserTransform) {
;
; Object version of Ripples in Standard.uxf.
;
; Adds water ripples to a fractal. Add multiple transforms
; for interference effects.
;
; Originally written by Damien M. Jones.
;
public:
complex func Iterate(complex pz)
complex center2 = @twirlcenter
if (@centermove)
center2 = #center
endif
float d = cabs(pz-center2)
if (d < @twirlfade)
if (@twirltype == 0) ; side to side
return (pz-center2) * (0,1) ^ (cos(d*@twirlpitch*#pi) * @twirlscale * sqr(1-d/@twirlfade)) + center2
elseif (@twirltype == 1) ; forward and back
return (pz-center2) * (1 - cos(d*@twirlpitch*#pi) * @twirlscale * sqr(1-d/@twirlfade)) + center2
elseif (@twirltype == 2) ; in and out
float d2 = atan(imag(pz-center2)/real(pz-center2))
if (real(d2) < 0) ; pointing to left
d2 = d2 + #pi ; rotate 180 degrees
endif
if (d2 < 0) ; negative angle (we want 0 < atan < pi*2)
d2 = d2 + #pi * 2 ; rotate 360 degrees
endif
return (pz-center2) * (1 - cos(d2*@twirlpitch) * @twirlscale * sqr(1-d/@twirlfade)) + center2
else ; back and forth
float d2 = atan(imag(pz-center2)/real(pz-center2))
if (real(d2) < 0) ; pointing to left
d2 = d2 + #pi ; rotate 180 degrees
endif
if (d2 < 0) ; negative angle (we want 0 < atan < pi*2)
d2 = d2 + #pi * 2 ; rotate 360 degrees
endif
return (pz-center2) * (0,1) ^ (cos(d2*@twirlpitch) * @twirlscale * sqr(1-d/@twirlfade)) + center2
endif
else
return pz
endif
endfunc
default:
title = "Ripples"
helpfile = "Uf*.chm"
helptopic = "Html/transformations/standard/ripples.html"
complex param twirlcenter
caption = "Ripple Center"
default = #center
enabled = !@centermove
hint = "Sets the center of the ripples."
endparam
param centermove
caption = "Use Screen Center"
default = false
hint = "If set, ripples will be around the center of \
the window, regardless of the Ripple Center \
setting."
endparam
param twirlscale
caption = "Ripple Strength"
default = 0.5
hint = "Sets the height of the ripples."
endparam
param twirlpitch
caption = "Ripple Frequency"
default = 20.0
min = 0.0
hint = "Frequency of ripples; higher values will give \
more densely packed ripples."
endparam
param twirlfade
caption = "Ripple Fade"
default = 1.0
min = 0.00000001
hint = "Distance at which ripples fade."
endparam
param twirltype
caption = "Ripple Type"
default = 1
enum = "Side to Side" "Forward and Back" "In and Out" "Back and Forth"
hint = "Orientation of ripples with respect to the \
ripple center."
endparam
}
Methods inherited from class Object |
|
Standard_Ripples
public Standard_Ripples()
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