class TrapShapeSuperShape(common.ulb:TrapShape) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; Super Shape UF5 Implementation ; c.kleinhuis 2008 ; ; Formula Taken from Paul Bourke's Website: ; http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/supershape/ ; ; visit fractalforums.com or fractalmovies.com ; for example usage of this formula ; public: func TrapShapeSuperShape(Generic pparent) TrapShape.TrapShape(pparent) endfunc float func Iterate(complex pz) TrapShape.Iterate(pz) float theta = atan2(pz); float res = TrapShapeSuperShape.super(theta, @a, @b, @n1, @n2, @n3, @m); float r = cabs(pz); float real=res*cos(theta)*r float imag=res*sin(theta)*r return sqrt(real*real+imag*imag) endfunc float func super(float theta, float a, float b, float n1, float n2, float n3, float m) float one = abs(cabs(cos(m * theta / 4.0) / a)^ n2) float two = abs(cabs(sin(m * theta / 4.0) / b)^ n3) return ((one + two)^ -1.0 / n1); endfunc default: title = "Super Shape" param n1 ; Overrides p_power from Formula caption = "n1" default = 3.0 hint = "n1 Variable from the SuperShape Formula." endparam param n2 ; Overrides p_power from Formula caption = "n2" default = 2.0 hint = "n1 Variable from the SuperShape Formula." endparam param n3 ; Overrides p_power from Formula caption = "n3" default = 0.1 hint = "n1 Variable from the SuperShape Formula." endparam param a ; Overrides p_power from Formula caption = "a" default = 1.0 hint = "a Variable from the SuperShape Formula." visible = false endparam param b ; Overrides p_power from Formula caption = "b" default = 1.0 hint = "b Variable from the SuperShape Formula." visible = false endparam param m ; Overrides p_power from Formula caption = "Number of Turns" default = 6.0 hint = "Number of Turns \n Even Numbers generate Closed Shapes\n " endparam } class ckFormulaObject(common.ulb:Formula) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This Object serves as base class for ck formulas public: default: complex param p_power caption = "Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal." visible=false endparam } class Manowar(common.ulb:DivergentFormula) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of Fractint Manowar Formula ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) oldz=pz; complex z= #pixel+@Pertubation z1=#pixel; oldz=z return z; endfunc complex func Iterate(complex pz) oldz = pz z = pz^@p_power + z1 + #pixel z1 = oldz return z; endfunc private: complex oldz; complex z1; default: title = "Manowar" rating = recommended helptopic = "Html/formulas/standard/mandelbrot.html" complex param Pertubation caption = "Pertubation" default = (0,0) endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam } class Manowar_Julia(common.ulb:DivergentFormula) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of Fractint Manowar Formula ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) pixel=pz; oldz=pz; complex z=pz z1=pixel; return z; endfunc complex func Iterate(complex pz) oldz = pz z = pz^@p_power + z1 + @Pertubation z1 = oldz return z; endfunc private: complex pixel; complex oldz; complex z1; default: title = "Manowar Julia" rating = recommended complex param Pertubation caption = "Pertubation" default = (0,0) endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam } class TransformBefore(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of the 2 Alternating Formula ; now everything is possible :D ; the 3 alternating formula is no longer needed. ; christian kleinhuis 2008 ; visit: ; fractalforums.com ; fractalmovies.com ; ; 2 Alternations is all you need ! ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f=new @formulaClass1(this) fTransform=new @transform(this) return f.Init(fTransform.Iterate(pz)); endfunc complex func Iterate(complex pz) return f.Iterate(#z) endfunc bool func IsBailedOut(complex pz) return f.IsBailedOut(pz) endfunc complex func GetPrimaryExponent() return f.GetPrimaryExponent() endfunc private: Formula f; UserTransform fTransform default: title = "Transform Formula Before" rating = recommended Formula param formulaClass1 caption = "Formula #1" default = Standard_Mandelbrot endparam UserTransform param transform caption = "Formula Transform" default = Location expanded = false hint = "Generic Transformation applied to z before iteration loop starts" endparam } class KIFSFormulaObject(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; author c.Kleinhuis 2013 ; Object version of Knighty's Kaleidoscopic IFS ; ; From This Fractalforums.com Thread: ; http://www.fractalforums.com/ifs-iterated-function-systems/kaleidoscopic-%28escape-time-ifs%29/ ; ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) return #pixel endfunc complex func Iterate(complex pz) complex z=pz complex rot1= cos(@rotation1/180*#Pi)+flip(sin(@rotation1/180*#Pi)) complex rot2= cos(@rotation2/180*#Pi)+flip(sin(@rotation2/180*#Pi)) z=z*rot1; float tempreal=real(z) float tempimag=imag(z) if tempreal+tempimag<0 float x1=-tempimag tempimag=-tempreal tempreal=x1 endif z=tempreal+flip(tempimag) z=z*rot2 tempreal=real(z) tempimag=imag(z) if tempreal<0 tempreal=-tempreal endif if tempimag<0 tempimag=-tempimag endif tempreal=@scale*tempreal-real(@center)*(@scale-1) tempimag=@scale*tempimag-imag(@center)*(@scale-1) z=tempreal+flip(tempimag) return z endfunc bool func IsBailedOut(complex pz) return |pz|>400 endfunc complex func GetPrimaryExponent() return 2 endfunc private: default: title = "Kaleidoscopic IFS" rating = recommended float param scale default=3 endparam float param rotation1 default=0 endparam float param rotation2 default=0 endparam complex param center default=(1,1) endparam } class AlternatingFormulaObject(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of the 2 Alternating Formula ; now everything is possible :D ; the 3 alternating formula is no longer needed. ; christian kleinhuis 2008 ; visit: ; fractalforums.com ; fractalmovies.com ; ; 2 Alternations is all you need ! ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) count=0 f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) f[1].Init(pz); return f[0].Init(pz); endfunc complex func Iterate(complex pz) count=count+1 return f[count%2].Iterate(#z) endfunc bool func IsBailedOut(complex pz) return f[count%2].IsBailedOut(pz) endfunc complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc private: int count; Formula f[2]; default: title = "Alternating Formula" rating = recommended Formula param formulaClass1 caption = "Formula #1" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Formula #2" default = Standard_Mandelbrot endparam } class ChangeFormula_AfterNIterations(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; This Formula allows you to choose a second formula to be taken at a certain iteration deepness ; christian kleinhuis 2008 ; visit: ; fractalforums.com ; fractalmovies.com ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) count=0 f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) f[1].Init(pz); atIteration=@atIteration; return f[0].Init(pz); endfunc complex func Iterate(complex pz) count=count+1 return getCurrentFormula().Iterate(pz) endfunc complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc bool func IsBailedOut(complex pz) return f[count%2].IsBailedOut(pz) endfunc private: int count; Formula f[2]; Formula func getCurrentFormula() if(count< @atIteration) return f[0]; endif return f[1]; endfunc default: title = "Change Formula" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam int param atIteration caption = "At Iteration" default = 0 endparam } class BlendFormula(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; This Formula let you choose 2 Fractal Formulas, ; and blend them with this formula you can transform any fractal into any other ; the only thing you should be aware is that mixing Divergent and Convergent ; can lead to problems ... ; christian kleinhuis 2008 ; visit: ; fractalforums.com ; fractalmovies.com ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) interpolator=new @Interpolator(this); f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return interpolator.Interpolate(@blend,z0,z1) endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) if(@blend==0) return f[0].Iterate(pz) elseif (@blend==1) return f[1].Iterate(pz) else return interpolator.Interpolate(@blend,f[0].Iterate(pz),f[1].Iterate(pz)) endif endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[2]; ComplexInterpolator interpolator; default: title = "Blend Formula" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam ComplexInterpolator param interpolator default= ComplexInterpolatorLinear endparam float param blend caption = "Blend" default = 0.5 endparam } class InterpolateBase(common.ulb:Generic) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This is the base class for interpolation of Complex Numbers public: import "Common.ulb" func InterpolateBase(Generic pparent) Generic.Generic(pparent) endfunc complex func Interpolate(float t,complex a,complex b) return this.doInterpolate(t,a,b) endfunc protected: complex func doInterpolate(float t,complex a,complex b) ; Template function doing the work... ; should be overriden from sub classes return 0; endfunc } class Linear(ck.ulb:InterpolateBase) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; Plain Linear Interpolation between two complex numbers public: import "Common.ulb" func Linear(Generic pparent) InterpolateBase.InterpolateBase(pparent) endfunc protected: complex func doInterpolate(float t,complex a,complex b) return a + t * (b - a) endfunc default: title = "Linear" rating = recommended } class SphericalLinear(ck.ulb:InterpolateBase) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; Spherical Linear Interpolation between two Complex numbers public: import "Common.ulb" func SphericalLinear (Generic pparent) InterpolateBase.InterpolateBase(pparent) endfunc protected: complex func doInterpolate(float t,complex a,complex b) complex _a=(0,0) complex _b=(0,0); float absa=cabs(a); float absb=cabs(b); if(absa>0) _a=a/absa endif if(absb>0) _b=b/absb endif float omega=(real(_a)*real(_b)+imag(_a)*imag(_b)); float sinomega=sin(omega) if(sinomega==0) sinomega=0.00000000001 endif complex res=lerp(t,absa,absb)* ((sin((1-t)*omega)*_a+sin(t*omega)*_b)/sinomega) return res; endfunc private: float func lerp(float t,float a,float b) return a + t * (b - a) endfunc default: title = "SphericalLinear" rating = recommended } class Image(common.ulb:UserTransform) { public: ; @param pparent a reference to the object creating the new object; typically, 'this' func Image(Generic pparent) UserTransform.UserTransform(pparent) i=new @imageParam(); endfunc complex func Iterate(complex pz) ;ratio=1; complex pix = (real(#screenpixel)/#width,imag(#screenpixel)/#height) color col=i.getColor(pix) float l=sqrt(red(col)*red(col)+green(col)*green(col)+blue(col)*blue(col)) return pz+ l*@scale endfunc private: Image i default: title = "Image" Image param imageParam caption = "Image" endparam float param scale caption = "Scale" default=1 endparam } class Easing (common.ulb:Generic){ ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This class defines an easing function, ; This Class Has only one function ; Ease(x) where x is in the range of 0..1 ; The return value is the eased version of the input value public: func Easing(Generic pparent) Generic.Generic(pparent) endfunc float func Ease(float x) return doEase(x); endfunc protected: float func doEase(float t) return t; endfunc default: title = "Ease None" } class EasingSineInOut (ck.ulb:Easing){ ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! protected: float func doEase(float t) float _t=t*#PI-(#PI/2) return sin(_t)*0.5+0.5; endfunc default: title = "Sine In Out" } class EasingSineOut (ck.ulb:Easing){ protected: float func doEase(float t) float _t=t*(#PI/2) return sin(_t); endfunc default: title = "Sine Out" } class EasingSineIn (ck.ulb:Easing){ ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! protected: float func doEase(float t) float _t=t*(#PI/2) -#PI/2 return sin(_t)+1; endfunc default: title = "Sine In" } class EasingBounceOut (ck.ulb:Easing){ ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! protected: float func doEase(float t) float x=t*(#PI*@turns+#PI/2); int segment=round(x/#PI); return 1-exp(-segment/2)*abs(cos(x)); endfunc default: title = "Bounce Out" float param turns caption = "# Bounces" default=2 endparam } class ComplexInterpolator(common.ulb:Generic) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This is the base class for interpolation of Complex Numbers public: import "Common.ulb" func ComplexInterpolator(Generic pparent) Generic.Generic(pparent) ; interpol=new @interpolation(this) ; easing=new @easing(this) endfunc complex func Interpolate(float t,complex a,complex b) return doInterpolate(t,a,b) endfunc complex func doInterpolate(float t,complex a,complex b) return a + t * (b - a) endfunc private: default: title = "Complex Linear Interpolation" } class ComplexInterpolatorLinear(ck.ulb:ComplexInterpolator) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This is the base class for interpolation of Complex Numbers public: import "Common.ulb" func ComplexInterpolatorLinear(Generic pparent) Generic.Generic(pparent) ; interpol=new @interpolation(this) ; easing=new @easing(this) endfunc complex func Interpolate(float t,complex a,complex b) return doInterpolate(t,a,b) endfunc complex func doInterpolate(float t,complex a,complex b) return a + t * (b - a) endfunc private: default: title = "Complex Linear Interpolation" } class ComplexInterpolatorPolar(ck.ulb:ComplexInterpolator) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; This is the base class for interpolation of Complex Numbers public: import "Common.ulb" func ComplexInterpolator(Generic pparent) Generic.Generic(pparent) ; interpol=new @interpolation(this) ; easing=new @easing(this) endfunc complex func Interpolate(float t,complex a,complex b) return doInterpolate(t,a,b) endfunc complex func doInterpolate(float t,complex a,complex b) float mag1=sqrt(real(a)*real(a)+imag(a)*imag(a)) float mag2=sqrt(real(b)*real(b)+imag(b)*imag(b)) float angle1= atan2(a) float angle2= atan2(b) float newmag= doInterpolateLinear(t,mag1,mag2) float newangle= doInterpolateLinear(t,angle1,angle2) return newmag*cos(newangle)+flip(newmag*sin(newangle)) endfunc float func doInterpolateLinear(float t,float a,float b) return a + t * (b - a) endfunc private: default: title = "Complex Polar Linear Interpolation" } ; Formulas from fractint class fn_z(common.ulb:DivergentFormula) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of Fractint Manowar Formula ; public: import "Common.ulb" import "Standard.ulb" func fn_formula(Generic pparent) DivergentFormula.DivergentFormula(pparent) endfunc complex func Init(complex pz) return pz endfunc complex func Iterate(complex pz) return fn1(pz^@p_power) endfunc private: Formula f; default: title = "fn(z^power)" rating = recommended func fn1 caption = "First Function" default = sin() endfunc complex param p_power caption = "Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal." visible=true endparam } class fn_z_plus_fn_pixel(common.ulb:DivergentFormula) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of Fractint Manowar Formula ; public: import "Common.ulb" import "Standard.ulb" func fn_formula(Generic pparent) DivergentFormula.DivergentFormula(pparent) endfunc complex func Init(complex pz) pixel=pz; return pz+@start endfunc complex func Iterate(complex pz) return fn1(pz) + @p1 * fn2(pixel) endfunc private: complex pixel; default: title = "fn[z]+fn[pix]" rating = recommended func fn1 caption = "First Function" default = sin() endfunc func fn2 caption = "Second Function" default = sin() endfunc complex param p_power caption = "Exponent" default = (2,0) hint = "Defines the primary exponent for the fractal." visible=true endparam param start caption = "Perturbation" default = (0,0) endparam param p1 caption = "Coefficient" default = (1,0) endparam } class Basic(common.ulb:DirectColoring) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; Object version of Basic in Standard.ucl. ; ; Four basic and classic ways to color a fractal. Other classic ; algorithms are Decomposition, Binary Decomposition, and ; Distance Estimator. ; $define DEBUG public: color func Result(complex pz) float res=0; if @type == "Iteration" res = (m_Iterations/#maxiter) elseif @type == "Real" res = (@bailout + real(pz))/@bailout*2 elseif @type == "Imaginary" res= (@bailout + imag(pz))/ @bailout*2 else res= (@bailout + real(pz) + imag(pz))/@bailout*2 endif print(res) return (@_color1*res)+rgba(0,0,0,1) endfunc default: title = "Basic Direct" helpfile = "Uf*.chm" helptopic = "Html/coloring/standard/basic.html" param type caption = "Coloring Type" enum = "Iteration" "Real" "Imaginary" "Sum" hint = "Specifies how the fractal is colored. Most options work best \ with low bail-out values for the fractal formula, like 4. \ The Iteration option is the classic way to color fractals." endparam color param _color1 caption = "Color 1" endparam float param bailout caption = "Bailout" default= 4 endparam } class BaseFormulas_Add(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) return f[0].Iterate(pz)+f[1].Iterate(pz) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[2]; default: title = "Base Formula Add" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam } class BaseFormulas_Sub(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) return f[0].Iterate(pz)-f[1].Iterate(pz) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[2]; default: title = "Base Formula Sub" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam } class BaseFormulas_Mul(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) return f[0].Iterate(pz)*f[1].Iterate(pz) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[2]; default: title = "Base Formula Mul" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam } class BaseFormulas_Div(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) f[1]=new @formulaClass2(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) return f[0].Iterate(pz)/f[1].Iterate(pz) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[2]; default: title = "Base Formula Div" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam Formula param formulaClass2 caption = "Second Formula" default = Standard_Mandelbrot endparam } class BaseFormulas_Fn(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) z1=f[1].Init(pz); z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() e1=f[0].GetPrimaryExponent() e2=f[1].GetPrimaryExponent() if cabs(e1)>cabs(e2) return e1 else return e2 endif endfunc complex func Iterate(complex pz) return fn1(pz) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz) endfunc private: Formula f[1]; default: title = "Base Formula Function 1" rating = recommended func fn1 caption = "Function" default = sin() endfunc Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam } class BaseFormulas_SphereFold(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() return f[0].GetPrimaryExponent() endfunc complex func Iterate(complex pz) complex newz= f[0].Iterate(pz) float magnitude=cabs(newz) if magnitude<@radius magnitude=magnitude/@radius^2 elseif magnitude<1 magnitude=1/magnitude endif return @scale *((newz/cabs(newz))*magnitude ) endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) endfunc private: Formula f[1]; default: title = "Sphere Fold" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam float param radius caption="Radius" default=0.5 endparam float param scale caption="Scale" default=2 endparam } class BaseFormulas_BoxFold(ck.ulb:ckFormulaObject) { ; !!!WARNING!!! ; FORMULAS ARE SUBJECT TO CHANGE UF VERSIONING IS NOT USED ; THIS MAY LEAD TO CHANGES IN FUTURE UPDATES' ; !!! WARNING!!!! ; ; c.Kleinhuis 2013 ; The Base Formula Approach serves the purpose to provide a possibility to plug formulaas ; together, similar to hybrid variants, but this is a more concrete approach, providing ; the possibility to create whole formulas from scratch by click and play... ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) f[0]=new @formulaClass1(this) z0= f[0].Init(pz); return z0 endfunc ; @return the primary exponent parameter complex func GetPrimaryExponent() return f[0].GetPrimaryExponent() endfunc complex func Iterate(complex pz) complex newz=f[0].Iterate(pz) float tempreal=real(newz) float tempimag=imag(newz) if tempreal>@fold tempreal=2*@fold-tempreal elseif tempreal<-@fold tempreal=-2*@fold-tempreal endif if tempimag>@fold tempimag=2*@fold-tempimag elseif tempimag<-@fold tempimag=-2*@fold-tempimag endif z= tempreal+flip(tempimag) return @scale *z endfunc bool func IsBailedOut(complex pz) return f[0].IsBailedOut(pz) endfunc private: Formula f[1]; default: title = "Box Fold" rating = recommended Formula param formulaClass1 caption = "First Formula" default = Standard_Mandelbrot endparam float param fold caption="Fold" default=1 endparam float param scale caption="Scale" default=2 endparam } class Mandelbox(common.ulb:DivergentFormula) { ; ; Object version of Mandelbox Formula by Tom Lowe ; Found in the fractalforums ~2010 ; https://sites.google.com/site/mandelbox/what-is-a-mandelbox ; public: import "Common.ulb" import "Standard.ulb" complex func Init(complex pz) fPixel = pz if (@Pertubation == (0,0)); bug in beta 5 return pz else return @Pertubation endif endfunc complex func Iterate(complex pz) ; boxfold float tempreal=real(pz ); float tempimag=imag(pz ); if tempreal>1 tempreal=2-tempreal elseif tempreal<-1 tempreal=-2-tempreal endif if tempimag>1 tempimag=2-tempimag elseif tempimag<-1 tempimag=-2-tempimag endif tempreal=tempreal*@fold tempimag=tempimag*@fold ; spherefold float magnitude=sqrt(tempreal*tempreal+tempimag*tempimag) float newmagnitude=magnitude if magnitude<@radius newmagnitude=magnitude/ @radius^2 elseif magnitude<1 newmagnitude=1/magnitude endif tempreal=(tempreal/magnitude)*newmagnitude tempimag=(tempimag/magnitude)*newmagnitude complex result= tempreal +flip( tempimag ); return result *@scale +fPixel; endfunc private: complex fPixel default: title = "The AmazingBox" rating = recommended complex param Pertubation caption = "Pertubation" default = (0,0) endparam float param fold caption="Fold" default=1.0 endparam float param radius caption="Radius" default=0.5 endparam float param scale caption="Scale" default= 2.0 endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 256.0 min = 0.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." visible=false endparam } class ckBarnsley1(common.ulb:DivergentFormula) { ; ; Object version of Barnsley1 ; cKleinhuis 2013 ; public: complex func Init(complex pz) fPixel = pz return @start endfunc complex func Iterate(complex pz) IF real(pz) >= 0 pz = (pz - 1) * pixel ELSE pz = (pz + 1) * pixel ENDIF return pz endfunc private: complex fPixel default: title = "Barnsley1" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." visible=false endparam } class ckBarnsley2(common.ulb:DivergentFormula) { ; ; Object version of Barnsley1 ; cKleinhuis 2013 ; public: complex func Init(complex pz) pixel = pz return @start endfunc complex func Iterate(complex pz) IF real(pz) * imag(pixel) + real(pixel) * imag(pz) >= 0 pz = (pz - 1) * pixel ELSE pz = (pz + 1) * pixel ENDIF return pz endfunc private: complex pixel default: title = "Barnsley2" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." visible=false endparam } class ckBarnsley3(common.ulb:DivergentFormula) { ; ; Object version of Barnsley1 ; cKleinhuis 2013 ; public: complex func Init(complex pz) pixel = pz return @start endfunc complex func Iterate(complex pz) IF real(pz) > 0 pz = pz^@p_power - 1 ELSE pz = pz^@p_power - 1 + pixel * real(pz) ENDIF return pz endfunc private: complex pixel default: title = "Barnsley3" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." endparam } class ck_BurningShipVariant(common.ulb:DivergentFormula) { ; ; Variant of the Burning Ship Formula, taking the absolute value just for imaginarz part ; cKleinhuis 2013 ; public: complex func Init(complex pz) fPixel = pz return @start endfunc complex func Iterate(complex pz) pz= (real(pz)) +flip( abs(imag(pz))) ; boxfold return pz^@p_power + fPixel endfunc private: complex fPixel default: title = "Burning Ship Variant" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam } class ck_BurningShip(common.ulb:DivergentFormula) { ; ; Object Version of the Burning Ship Formula, ; cKleinhuis 2013 ; public: complex func Init(complex pz) fPixel = pz return @start endfunc complex func Iterate(complex pz) pz=abs (real(pz)) +flip( abs(imag(pz))) ; boxfold return pz^@p_power + fPixel endfunc private: complex fPixel default: title = "Burning Ship" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2,0) hint = "This parameter sets the exponent for the Mandelbrot formula. \ Increasing the real part to 3, 4, and so on, will add discs to \ the Mandelbrot figure. Non-integer real values and non-zero \ imaginary values will create distorted Mandelbrot sets. Use (2, 0) \ for the standard Mandelbrot set." endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam }