reb Class REB_TrapShapeKnotCurve

```Object
common:Generic
common:TrapShape
reb:REB_TrapShapeKnotCurve
```

`class TrapShape:REB_TrapShapeKnotCurve`

This shape uses the knot curve function.

This variant of the function involves taking a square root so there are two solutions. A signed and absolute value version of the distance is also available. The transformed value is the complex return value of the function.

Ultra Fractal Source
``` class REB_TrapShapeKnotCurve(common.ulb:TrapShape) {
; This shape uses the knot curve function.<br>
; <p>
; This variant of the function involves taking a square root
; so there are two solutions. A signed and absolute value version of
; the distance is also available. The transformed value is the
; complex return value of the function.
public:
import "common.ulb"

; Constructor
func REB_TrapShapeKnotCurve(Generic pparent)
TrapShape.TrapShape(pparent)
endfunc

; Call this for each iteration being trapped.
float func Iterate(complex pz)
TrapShape.Iterate(pz)
int sgn = 1
if @sgn
sgn = -1
endif
float d = 0
complex cy = imag(pz)
complex qx = 0
complex qa = 1
complex qb = -2
complex qc = 1 - 3*cy^2 - 2*cy^3
if @negroot == true
qx = ((-qb - (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
else
qx = ((-qb + (qb^2 - 4*qa*qc)^0.5)/(2*qa))^0.5
endif
if @absval == true
d = abs(cabs(pz) - cabs(@a*(qx + sgn*flip(cy))))
else
d = cabs(pz - @a*(qx + sgn*flip(cy)))
endif
m_LastZ = @a*(qx + sgn*flip(cy))
return d
endfunc

default:
title = "KnotCurve"
int param v_trapshapeknotcurve
caption = "Version (Trap Shape Knot Curve)"
default = 101
hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
visible = @v_trapshapeknotcurve < 101
endparam

float param a
caption = "Polar parameter"
default = 0.2
hint = "Affects spread and scale of trap"
endparam
bool param sgn
caption = "Conjugate transform"
default = false
endparam
param absval
caption = "Absolute Value"
default = false
endparam
param negroot
default = true
endparam
}
```

Constructor Summary
`REB_TrapShapeKnotCurve()`

`REB_TrapShapeKnotCurve(Generic pparent)`
Constructor

Method Summary
` float` `Iterate(complex pz)`
Call this for each iteration being trapped.

Methods inherited from class common:TrapShape
`GetColorChannel, GetTextureValue, GetTransformedPoint, Init, IterateSilent, SetThreshold`

Methods inherited from class common:Generic
`GetParent`

Methods inherited from class Object

Constructor Detail

REB_TrapShapeKnotCurve

`public REB_TrapShapeKnotCurve(Generic pparent)`
Constructor

REB_TrapShapeKnotCurve

`public REB_TrapShapeKnotCurve()`
Method Detail

Iterate

`public float Iterate(complex pz)`
Call this for each iteration being trapped.

Overrides:
`Iterate` in class `TrapShape`