mmf
Class MMF_TrapShapeCurvature
Object
common:Generic
common:TrapShape
mmf:MMF_TrapShapeZold
mmf:MMF_TrapShapeCurvature
class
- MMF_TrapShapeZold:MMF_TrapShapeCurvature
Based on the original curvature formula by Damien Jones.
Ultra Fractal Source
Toggle UF Source Code Display
class MMF_TrapShapeCurvature(MMF_TrapShapeZold) {
;
; Based on the original curvature formula by Damien Jones.<br>
;
public:
import "common.ulb"
func MMF_TrapShapeCurvature(Generic pparent)
MMF_TrapShapeZold.MMF_TrapShapeZold(pparent)
endfunc
; The recip(0) ensures that "no result" due to no zold or zolder
; returns a value outside the threshold<br>
float func Iterate(complex pz)
float r = recip(0)
; m_Iterations = m_Iterations + 1 not used in this trapshape
m_LastZ = pz
if @type=="Original" && m_zolderok
r = atan2((pz - m_zold)/(m_zold - m_zolder))
elseif @type=="One Centre" && m_zoldok
r = atan2((pz - @centre1)/(m_zold - @centre1))
elseif @type=="Two Centres" && m_zoldok
r = atan2((pz - @centre1)/(m_zold - @centre2))
elseif @type=="Centre Offsets" && m_zolderok
r = atan2((pz - m_zold - @centre1)/(m_zold - m_zolder - @centre2))
endif
if r<1e100
if @method=="Absolute Angles"
r = 2.0*abs(r)
elseif @method=="All Angles #1"
r = abs(#pi + r)
elseif @method=="All Angles #2"
if r<0
r = r + 2.0*#pi
endif
endif
if @usesine
r = 0.5*abs(1.0 + sin(r))
else
r = r/(2.0*#pi)
endif
endif
m_zolder = m_zold
m_zold = pz
m_zolderok = m_zoldok
m_zoldok = true
return r
endfunc
default:
title = "Curvature"
heading
text = "Intended for use with 'MMF Smooth Orbit Traps (Gradient)' or \
similar smoothing formulas since smoothing is often required."
endheading
int param type
caption = "Curvature Type"
enum = "Original" "One Centre" "Two Centres" "Centre Offsets"
default = 0
endparam
complex param centre1
caption = "Centre 1"
default = (0,0)
visible = @type>0
endparam
complex param centre2
caption = "Centre 2"
default = (0,0)
visible = @type>1
endparam
int param method
caption = "Angle method"
enum = "Absolute Angles" "All Angles #1" "All Angles #2" "Raw Angles"
default = 0
endparam
bool param usesine
caption = "Use Sine"
default = false
hint = "When enabled the sine of the angle is taken."
endparam
}
Method Summary |
float |
Iterate(complex pz)
The recip(0) ensures that "no result" due to no zold or zolder
returns a value outside the threshold
|
Methods inherited from class Object |
|
MMF_TrapShapeCurvature
public MMF_TrapShapeCurvature(Generic pparent)
MMF_TrapShapeCurvature
public MMF_TrapShapeCurvature()
Iterate
public float Iterate(complex pz)
- The recip(0) ensures that "no result" due to no zold or zolder
returns a value outside the threshold
- Overrides:
Iterate
in class MMF_TrapShapeZold
- Parameters:
pz
- the z value
- Returns:
- trap distance