Principal | Gráficos 3D | Gráficos 2D | Fractales | Math | Códigos | Tutoriales | Links

Biomorph

Este Fractal Biomorph, pertenece a la familia de Conjuntos de Julia donde la constante compleja C es 0.2 y el exponente de Z es 1.5.

Zn+1 = Zn1.5 + 0.2

donde Z es un número complejo

Generación del Fractal Biomorph

Es muy similar al del Conjunto de Julia, la difucultad esta en evaluar Z1.5 ya que se tratan de números complejos.

biomorph1.jpg
xmin = 0.06, ymin = 0.36, xmax = 0.42, ymax = 0.63, Iteraciones = 256

Observación

Como Z=ReZ + ImZi, entonces tenemos
Z=Z1.5 + 0.2
para evaluar esta expreción utilizo la rutina FloatPower que toma como
argumentos a ReZ, ImZ y me devuelve en xtmp, ytmp elevado a 1.5.
ReZ = xtmp + ReC
ImZ = ytmp + ImC
donde ReC=0.2 y ImC=0.

Código Fuente

En biomorph.zip (6 Kb) se encuentra el código completo en VisualBasic para generar la imagen de arriba, sin executable.

Sub Convercion(x As Double, y As Double, r As Double, theta As Double)
If x = 0# Then
    If y = 0# Then
        r = 0#
        theta = 0#
    Else
        If y > 0# Then
            r = y
            theta = 0.5 * PI
        Else
            r = -y
            theta = -0.5 * PI
        End If
    End If
Else
    r = Sqr(x * x + y * y)
    theta = Atn(y / x)
    If x < 0# Then
        If y >= 0# Then
            theta = PI + theta
        Else
            theta = -PI + theta
        End If
    End If
End If
End Sub

Function Power(x As Double, y As Double) As Double
If x = 0# Then
    If y = 0# Then
        Power = 1#
    Else
        Power = 0#
    End If
Else
    Power = Exp(Log(x) * y)
End If
End Function

Sub FloatPower(x As Double, y As Double, a As Double, b As Double, N As Double)
Dim r As Double
Dim theta As Double
Dim atmp, btmp As Double

If (x * x + y * y) = 0# Then
    If N = 0# Then
        a = 1#
        b = 0#
    Else
        a = 0#
        b = 0#
    End If
Else
    Convercion x, y, r, theta
    atmp = Power(r, N)
    btmp = theta * N
End If
a = atmp * Cos(btmp)
b = atmp * Sin(btmp)
End Sub

Private Sub AdjustAspect()
Dim want_aspect As Single
Dim canvas_aspect As Single
Dim hgt As Single
Dim wid As Single
Dim mid As Single
want_aspect = (ymax - ymin) / (xmax - xmin)
canvas_aspect = screeny / screenx
If want_aspect > canvas_aspect Then
    wid = (ymax - ymin) / canvas_aspect
    mid = (xmin + xmax) / 2
    VisibleXmin = mid - wid / 2
    VisibleXmax = mid + wid / 2
    VisibleYmin = ymin
    VisibleYmax = ymax
Else
    hgt = (xmax - xmin) * canvas_aspect
    mid = (ymin + ymax) / 2
    VisibleYmin = mid - hgt / 2
    VisibleYmax = mid + hgt / 2
    VisibleXmin = xmin
    VisibleXmax = xmax
End If
End Sub

Private Sub Command1_Click()
Dim i, j As Integer
Dim ReZ As Double
Dim ImZ As Double
Dim ReC, ImC As Double
Dim N As Integer
Dim xtmp As Double
Dim ytmp As Double
Dim Red As Double
Dim Green As Double
Dim Blue As Double

AdjustAspect
ReC = -0.2
ImC = 0#
For j = 0 To screeny
    For i = 0 To screenx
        ReZ = ((VisibleXmax - VisibleXmin) / screenx) * i + VisibleXmin
        ImZ = ((VisibleYmax - VisibleYmin) / screeny) * j + VisibleYmin
        N = 0
        Do While (N < iterationMax) And (ReZ * ReZ + ImZ * ImZ < 4)
            FloatPower ReZ, ImZ, xtmp, ytmp, 1.5
            ReZ = xtmp + ReC
            ImZ = ytmp + ImC
            N = N + 1
        Loop
        Red = RGBColor(N, 0)
        Green = RGBColor(N, 1)
        Blue = RGBColor(N, 2)
        Picture1.PSet (i, screeny - j), RGB(Red, Green, Blue)
    Next i
Next j
End Sub


valcoey@hotmail.com

Ramiro Alcocer, 2001

Principal | Gráficos 3D | Gráficos 2D | Fractales | Math | Códigos | Tutoriales | Links