mt
Class MT_WheelTransform
Object
common:Generic
common:Transform
common:UserTransform
mt:MT_WheelTransform
class
- UserTransform:MT_WheelTransform
Mark Townsend, May 2008
Ultra Fractal Source
Toggle UF Source Code Display
class MT_WheelTransform(common.ulb:UserTransform) {
;
; Mark Townsend, May 2008
;
public:
func MT_WheelTransform(Generic pparent)
UserTransform.UserTransform(pparent)
endfunc
complex func Iterate(complex pz)
m_Iterations = m_Iterations + 1
float outer = @inner + @width
float r = cabs(pz - @center)
if (r > @inner) && (r < outer)
; within the wheel
float theta = atan2(pz - @center)
if theta < 0
theta = theta + 2 * #pi
endif
float outer_dist = abs(outer - r)
float inner_dist = abs(@inner - r)
if outer_dist < inner_dist
float ratio = @width / outer_dist
else
ratio = @width / inner_dist
endif
theta = theta + real(@fn1(@distort / ratio))
float x = r * cos(theta)
float y = r * sin(theta)
return x + flip(y) + @center
else
return pz
endif
endfunc
default:
title = "Wheel"
param inner
caption = "Inner rim"
default = 0.3
endparam
param width
caption = "Width"
default = 0.6
endparam
param center
caption = "Center"
default = (0,0)
endparam
param distort
caption = "Distortion"
default = 2.0
endparam
func fn1
caption = "Function"
default = ident()
endfunc
}
Methods inherited from class Object |
|
MT_WheelTransform
public MT_WheelTransform(Generic pparent)
MT_WheelTransform
public MT_WheelTransform()
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