mmf
Class MMF_TrapShapeCentreOfCurvature
Object
common:Generic
common:TrapShape
mmf:MMF_TrapShapeZold
mmf:MMF_TrapShapeCentreOfCurvature
class
- MMF_TrapShapeZold:MMF_TrapShapeCentreOfCurvature
Based on the original "curvature" by Luke Plant.
Ultra Fractal Source
Toggle UF Source Code Display
class MMF_TrapShapeCentreOfCurvature(MMF_TrapShapeZold) {
; Based on the original "curvature" by Luke Plant.<br>
public:
import "common.ulb"
func MMF_TrapShapeCentreOfCurvature(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 m_zoldok
float x2m1 = real(m_zold) - real(pz)
float y2m1 = imag(m_zold) - imag(pz)
float x3m1 = real(m_zolder) - real(pz)
float y3m1 = imag(m_zolder) - imag(pz)
float x2y2s = x2m1*(real(m_zold) + real(pz)) \
+ y2m1*(imag(m_zold) + imag(pz))
float x3y3s = x3m1*(real(m_zolder) + real(pz)) \
+ y3m1*(imag(m_zolder) + imag(pz))
float d = 2.0*(x2m1*y3m1-x3m1*y2m1)
complex c = y3m1*x2y2s - y2m1*x3y3s + flip(x2m1*x3y3s - x3m1*x2y2s)
if abs(d)<1e-5
if abs(d)*1e100<abs(real(c)) || abs(d)*1e100<abs(imag(c))
c = 1e100 * (c/cabs(c))
else
c = c/d
endif
else
c = c/d
endif
if @p_trap=="Radius"
r = cabs(pz - c)
elseif @p_trap=="Distance to Trap Value"
r = cabs(c - @p_trapval)
elseif @p_trap=="Centripetal"
r = |pz - m_zold|/cabs(pz - c)
elseif @p_trap=="Old Centripetal"
r = |m_zold - m_zolder|/cabs(pz - c)
else
if @p_trap=="Angle of z to centre"
r = atan2(pz - c)
elseif @p_trap=="Angle of zold to centre"
r = atan2(m_zold - c)
elseif @p_trap=="Angle of zolder to centre"
r = atan2(m_zolder - c)
elseif @p_trap=="Angle of centre to Trap Value"
r = atan2(c - @p_trapval)
endif
if @p_angles=="Absolute Angles"
r = abs(r)
elseif @p_angles=="All Angles"
r = abs(#pi + r)
elseif @p_angles=="Cosines"
r = abs(sin(0.5*(#pi + r)))
endif
endif
if @p_scale
r = r/cabs(pz)
endif
if @p_loglog
r = log(1+log(1+r))
endif
endif
m_zolder = m_zold
m_zold = pz
; m_zolderok = m_zoldok not needed
m_zoldok = true
return r
endfunc
default:
title = "Centre of Curvature"
heading
text = "Intended for use with 'MMF Smooth Orbit Traps (Gradient)' or \
similar smoothing formulas since smoothing is often required."
endheading
int param p_trap
caption = "Value to trap"
enum = "Radius" "Distance to Trap Value" "Centripetal" \
"Old Centripetal" "Angle of z to centre" \
"Angle of zold to centre" "Angle of zolder to centre" \
"Angle of centre to Trap Value"
default = 2
endparam
complex param p_trapval
caption = "Trap Value"
default = (0,0)
visible = @p_trap==1 || @p_trap==7
endparam
int param p_angles
caption = "Angle method"
enum = "Raw Angles" "Absolute Angles" "All Angles" "Cosines"
default = 2
visible = @p_trap>3
endparam
bool param p_scale
caption = "Divide by magnitude"
default = false
hint = "May help if some areas get too busy."
endparam
bool param p_loglog
caption = "Apply log(log("
default = true
hint = "Avoids the coluring becoming too varied."
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_TrapShapeCentreOfCurvature
public MMF_TrapShapeCentreOfCurvature(Generic pparent)
MMF_TrapShapeCentreOfCurvature
public MMF_TrapShapeCentreOfCurvature()
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