## reb Class REB_TrapShape4DOrbit

```Object
common:Generic
common:TrapShape
reb:REB_TrapShape4DOrbit
```

`class TrapShape:REB_TrapShape4DOrbit`

Based upon the 4D fractal formula approach of Gordon Lamb.

This class can be used to explore in the two "hybridised" planes. Type SJ iterates in the "zc" plane, and type 3RDIM in the "cz" plane. The trap can create multiple fractal images of the chosen function.

Ultra Fractal Source
``` class REB_TrapShape4DOrbit(common.ulb:TrapShape) {
; Based upon the 4D fractal formula approach of Gordon Lamb. <br>
; <p>
; This class can be used to explore in the two "hybridised" planes.
; Type SJ iterates in the "zc" plane, and type 3RDIM in the "cz" plane.
; The trap can create multiple fractal images of the chosen function.
public:
import "common.ulb"

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

; Call this for each iteration being trapped.
float func Iterate(complex pz)
TrapShape.Iterate(pz)
complex p = (0,0)
complex px = pz*@scale
complex c = 0
if @function == "Julia Frame-Robert" || @function == "Julia Ikenaga" || \
@function == "Julia Lambda" || @function == "Julia"
px = @seed
p = pz*@scale
endif
if @variant == "SJ"
p = real(p) + flip(imag(p)*@r)
c = @t + @r*real(px) + flip(imag(px))
else
p = @r*real(p) + flip(imag(p))
c = @t + real(px) + flip(imag(px)*@r)
endif
p = @fn1(p)
int rt_iter = 0

while rt_iter < @max_iterations && (|p| < @bailout)
if @function == "Mandelbrot" || @function == "Julia"
p = p*p + c
elseif @function == "Julia Lambda"
p = c*p*(1-p)
elseif @function == "Ikenaga" || @function == "Julia Ikenaga"
p = p*p*p + (c-1)*p-c
elseif @function == "Frame-Robert" || @function == "Julia Frame-Robert"
p = p*p*p/5 + p*p + c
endif
rt_iter = rt_iter + 1
endwhile
m_LastZ = @fn2(p)
float d = abs(cabs(pz)-cabs(m_LastZ))
return d
endfunc

default:
title = "4D Orbit"
int param v_trapshape4dorbit
caption = "Version (Trap Shape 4D Orbit)"
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_trapshape4dorbit < 101
endparam
param t
caption = "Translation"
default = -0.75
endparam
param r
caption = "Tilt"
default = 0.5
min = 0
max = 1
hint = "This parameter takes values between 0 and 1 inclusive."
endparam
param variant
caption = "4D variant"
default = 0
enum = "SJ" "3RDIM"
hint = "These variants are based upon Gordon Lamb's 4D formulas."
endparam
param max_iterations
caption = "4D iterations"
hint = "This is the number of iterations for the 4D formula."
default = 10
endparam
float param bailout
caption = "Bailout"
default = 10000.0
endparam
float param scale
caption = "Scale"
default = 1.0
endparam
param function
caption = "4D Fractal"
default = 1
enum = "Frame-Robert" "Ikenaga" "Mandelbrot" "Julia Frame-Robert" \
"Julia Ikenaga" "Julia Lambda" "Julia"
endparam
complex param seed
caption = "Julia seed"
default = (0,0)
visible = @function == "Julia Frame-Robert" || @function == "Julia Ikenaga" \
|| @function == "Julia Lambda" || @function == "Julia"
endparam
func fn1
caption = "Pre Function"
default = ident()
endfunc
func fn2
caption = "Post Function"
default = ident()
endfunc
}
```

Constructor Summary
`REB_TrapShape4DOrbit()`

`REB_TrapShape4DOrbit(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_TrapShape4DOrbit

`public REB_TrapShape4DOrbit(Generic pparent)`
Constructor

### REB_TrapShape4DOrbit

`public REB_TrapShape4DOrbit()`
Method Detail

### Iterate

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

Overrides:
`Iterate` in class `TrapShape`