lunes, 20 de julio de 2015

El jardinero de Neruda

(es) El jardinero de Neruda

(eo) La ĝardenisto de NERUDA

El jardinero de Neruda

Descripción artística:

Un jardín de plantas fractales rodeando un gran árbol cuadrado que representa una Ceiba.

Motivación:

El recuerdo de un capítulo nunca hecho del libro de Graficación por Computadora del autor... Sería un capítulo sobre fractales biológicos.

Descripción técnica:

Se han utilizado cuatro algoritmos recursivos determinísticos que dibujan “ramas que tienen ramas”. Uno de los algoritmos divide sus ramas en dos ramas, otro divide sus ramas en tres ramas, otro en cuatro y el último en cinco.
Cada árbol depende además de una posición, ángulos de las ramas divididas, tamaño, proporciones entre las ramas y sus ramas hijas, la cantidad de subdivisiones (niveles), posiciones relativas de los brotes de las ramas hijas y el color.

Archivos

Código (Logo - kturtle):

#!/usr/bin/env python
# coding: utf-8

# Copyright 2015 Eduardo Adam Navas López
# Este programa es Software Libre liberado bajo la licencia GNU GPLv3 o su versión más reciente:
# http://www.gnu.org/licenses/gpl.html

reset
canvassize 8000, 8000


learn arbusto4 $xini, $yini, $ang1, $ang2, $largo, $factor, $nivel, $prop, $cr, $cg, $cb{
  go (xi $xini), (yi $yini)
  pencolor $cr, $cg, $cb
  rama4 $ang1, $ang2, $largo, $factor, $nivel, $prop
}

learn rama4 $ang1, $ang2, $largo, $factor, $nivel, $prop{
  if $nivel>0{
    pendown
    forward $largo
    penup

    turnright $ang2
    rama4 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnleft $ang2*2
    rama4 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnright $ang2

    backward $largo*$prop
    turnright $ang1
    rama4 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnleft $ang1*2
    rama4 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnright $ang1

    backward $largo*(1-$prop)
  }
}

learn arbusto2 $xini, $yini, $ang1, $ang2, $largo, $factor, $nivel, $cr, $cg, $cb{
  go (xi $xini), (yi $yini)
  pencolor $cr, $cg, $cb
  rama2 $ang1, $ang2, $largo, $factor, $nivel
}

learn rama2 $ang1, $ang2, $largo, $factor, $nivel{
  if $nivel>0{
    pendown
    forward $largo
    penup

    turnright $ang1
    rama2 $ang1, $ang2, $largo*$factor, $factor, $nivel-1
    turnleft $ang1
    turnleft $ang2
    rama2 $ang1, $ang2, $largo*$factor, $factor, $nivel-1
    turnright $ang2

    backward $largo
  }
}

learn arbusto5 $xini, $yini, $ang1, $ang2, $largo, $factor, $nivel, $prop1, $prop2, $cr, $cg, $cb{
  go (xi $xini), (yi $yini)
  pencolor $cr, $cg, $cb
  rama5 $ang1, $ang2, $largo, $factor, $nivel, $prop1, $prop2
}

learn rama5 $ang1, $ang2, $largo, $factor, $nivel, $prop1, $prop2{
  if $nivel>0{
    pendown
    forward $largo
    rama5 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop1, $prop2
    penup

    backward $largo*$prop1
    turnright $ang1
    rama5 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop1, $prop2
    turnleft $ang1
    turnleft $ang2
    rama5 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop1, $prop2
    turnright $ang2

    backward $largo*$prop2
    turnright $ang1
    rama5 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop1, $prop2
    turnleft $ang1
    turnleft $ang2
    rama5 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop1, $prop2
    turnright $ang2

    backward $largo*(1-$prop1-$prop2)
  }
}

learn arbusto3 $xini, $yini, $ang1, $ang2, $largo, $factor, $nivel, $prop, $cr, $cg, $cb{
  go (xi $xini), (yi $yini)
  pencolor $cr, $cg, $cb
  rama3 $ang1, $ang2, $largo, $factor, $nivel, $prop
}

learn rama3 $ang1, $ang2, $largo, $factor, $nivel, $prop{
  if $nivel>0{
    pendown
    forward $largo
    rama3 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    penup

    backward $largo*$prop
    turnright $ang1
    rama3 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnleft $ang1
    turnleft $ang2
    rama3 $ang1, $ang2, $largo*$factor, $factor, $nivel-1, $prop
    turnright $ang2

    backward $largo*(1-$prop)
  }
}

learn xi $x {
  return 250*$x+250
}
learn yi $y {
  return 750*$y+1250
}

penwidth 5
$tam = 500

##Fila 1
arbusto5  1, 0, 20, 25, $tam, 0.6, 6, 0.2, 0.3, 124,166,41
arbusto2  4, 0, 20, 20, $tam, 0.6, 11, 0,130,0
arbusto4  7, 0, 35, 25, $tam, 0.6, 7, 0.3, 0,128,0
arbusto2  9, 0, 20, 10, $tam, 0.6, 11, 65,130,65
arbusto4 11, 0, 25, 15, $tam, 0.5, 6, 0.7, 0,80,0
arbusto4 13, 0, 35, 25, 5*$tam/4, 0.3, 6, 0.4, 20,130,20
arbusto3 15, 0, 10, 20, $tam, 0.6, 8, 0.4, 32,138,87
arbusto4 17, 0, 35, 25, 3*$tam/2, 0.4, 6, 0.6, 40,115,65
arbusto2 19, 0, 19, 11, $tam, 0.6, 10, 55,99,57
arbusto4 21, 0, 20, 5, $tam, 0.6, 6, 0.6, 56,112,56
arbusto2 24, 0, 15, 25, 4*$tam/5, 0.6, 10, 21,129,26
arbusto2 26, 0, 5, 15, 5*$tam/4, 0.4, 7, 101,153,46
arbusto2 28, 0, 60, 30, 4*$tam/5, 0.7, 14, 103,138,103

##Fila 2
arbusto3  0, 1, 35, 18, $tam, 0.5, 8, 0.4, 87,138,32
arbusto2  2, 1, 30, 30, 3*$tam/5, 0.6, 10, 88,135,38
arbusto3  4, 1, 25, 15, $tam, 0.7, 9, 0.4, 111,168,50
arbusto5  7, 1, 25, 30, $tam, 0.6, 7, 0.3, 0.4, 123,152,91
arbusto4 10, 1, 40, 30, 3*$tam/4, 0.6, 7, 0.3, 45,75,13
arbusto3 12, 1, 20, 20, $tam, 0.6, 8, 0.4, 117,116,35
arbusto5 14, 1, 25, 30, $tam, 0.3, 5, 0.2, 0.3, 37,117,35
arbusto2 16, 1, 8, 30, $tam/2, 0.7, 11, 0,127,64
arbusto4 18, 1, 30, 15, $tam, 0.5, 6, 0.3, 96,127,32
arbusto3 20, 1, 19, 36, $tam, 0.5, 8, 0.4, 78,117,35
arbusto5 22, 1, 45, 30, $tam, 0.4, 6, 0.3, 0.4, 0,130,0
arbusto2 24, 1, 12, 23, $tam, 0.5, 8, 0,102,51
arbusto3 26, 1, 20, 20, $tam, 0.7, 9, 0.7, 65,130,65
arbusto4 29, 1, 23, 38, $tam, 0.5, 6, 0.5, 0,128,0

##Fila 3
arbusto3  1, 2, 35, 25, $tam, 0.6, 8, 0.3, 124,166,41
arbusto4  4, 2, 20, 10, $tam, 0.6, 7, 0.3, 48,120,32
arbusto4  6, 2, 23, 28, $tam, 0.4, 6, 0.6, 20,130,20
arbusto4  9, 2, 30, 15, $tam, 0.6, 7, 0.3, 0,80,0
arbusto3 11, 2, 18, 21, $tam, 0.4, 7, 0.5, 40,115,65
arbusto4 13, 2, 41, 28, $tam/2, 0.6, 6, 0.3, 32,138,87
arbusto2 15, 2, 20, 27, 3*$tam/5, 0.7, 12, 55,99,57
arbusto3 17, 2, 20, 23, $tam, 0.65, 8, 0.4, 21,129,26
arbusto5 19, 2, 27, 31, 5*$tam/4, 0.4, 6, 0.2, 0.3, 83,108,83
arbusto3 21, 2, 13, 19, $tam, 0.6, 8, 0.4, 56,112,56
arbusto2 23, 2, 25, 13, $tam/2, 0.7, 11, 87,138,32
arbusto4 26, 2, 32, 39, $tam, 0.5, 7, 0.5, 123,152,91
arbusto3 29, 2, 22, 20, $tam, 0.6, 8, 0.4, 88,135,38

##Fila 4
arbusto4  1, 3, 30, 40, $tam, 0.5, 7, 0.95, 101,153,46
arbusto2  3, 3, 16, 18, 4*$tam/5, 0.6, 10, 45,75,13
arbusto2  4, 3, 16,  8, 5*$tam/4, 0.4, 7, 78,117,35
arbusto2  6, 3, 15, 25, 4*$tam/5, 0.6, 10, 111,168,50
arbusto4  8, 3, 20, 10, $tam, 0.6, 7, 0.9, 48,120,32
arbusto2 10, 3, 22, 11, $tam/2, 0.6, 9, 37,117,35
arbusto3 12, 3, 10, 20, $tam, 0.6, 8, 0.4, 117,116,35
arbusto4 14, 3, 35, 25, $tam, 0.5, 7, 0.7, 124,166,41
arbusto4 16, 3, 35, 25, 5*$tam/4, 0.3, 6, 0.4, 0,102,51
arbusto4 18, 3, 25, 15, $tam, 0.5, 6, 0.7, 0,128,0
arbusto4 21, 3, 35, 25, $tam, 0.6, 7, 0.3, 20,130,20
arbusto2 24, 3, 20, 20, $tam, 0.6, 10, 65,130,65
arbusto5 26, 3, 25, 30,5*$tam/4, 0.45, 6, 0.4, 0.4, 0,127,64
arbusto5 28, 3, 20, 25, $tam, 0.6, 6, 0.2, 0.3, 0,130,0
arbusto4 30, 3, 65, 35, $tam, 0.3, 6, 0.4, 32,138,87

##Fila 5
arbusto5  0, 4, 40, 30, $tam, 0.4, 6, 0.3, 0.4, 0,80,0
arbusto2  2, 4, 25, 15, $tam, 0.6, 10, 32,138,87
arbusto4  4, 4, 60, 21, $tam, 0.4, 6, 0.0, 40,115,65
arbusto4  6, 4, 10, 15, $tam, 0.4, 6, 0.9, 96,127,32
arbusto5  8, 4, 25, 30, $tam, 0.45, 6, 0.4, 0.4, 103,138,103
arbusto4 10, 4, 35, 25, $tam, 0.3, 6, 0.4, 87,138,32
arbusto2 12, 4, 10, 20, $tam, 0.6, 10, 21,129,26
arbusto4 14, 4, 20,  5, $tam, 0.6, 6, 0.8, 55,99,57
arbusto3 16, 4, 20, 10, $tam, 0.6, 7, 0.1, 88,135,38
arbusto2 18, 4, 30, 30, $tam, 0.4, 8, 123,152,91
arbusto3 20, 4, 32, 39, 5*$tam/4, 0.5, 8, 0.5, 56,112,56
arbusto4 22, 4, 23, 28, $tam, 0.4, 6, 0.6, 111,168,50
arbusto4 24, 4, 30, 15, $tam, 0.6, 7, 0.3, 101,153,46
arbusto3 27, 4, 38, 31, $tam, 0.4, 7, 0.1, 117,116,35
arbusto4 29, 4, 41, 28, $tam, 0.5, 7, 0.6, 37,117,35

##Fila 6
arbusto4  1, 5, 30, 60, $tam, 0.45, 7, 0.0, 45,75,13
arbusto4  3, 5, 35, 25, $tam, 0.5, 7, 0.6, 78,117,35
arbusto3  5, 5, 10, 20, $tam, 0.6, 7, 0.1, 48,120,32
arbusto3  7, 5, 60, 60, $tam, 0.5, 8, 0.2, 0,127,64
arbusto3  9, 5, 34, 28, $tam, 0.4, 7, 0.6, 96,127,32
arbusto3 11, 5, 60, 60, $tam, 0.4, 7, 0.0, 0,102,51

arbusto3 19, 5, 31, 40, $tam, 0.4, 7, 0.6, 124,166,41
arbusto3 21, 5, 64, 55, $tam, 0.4, 7, 0.15, 0,130,0
arbusto3 23, 5, 38, 31, $tam, 0.5, 8, 0.6, 0,128,0
arbusto3 25, 5, 18, 35, 3*$tam/2, 0.5, 8, 0.4, 65,130,65
arbusto4 27, 5, 35, 25, 4*$tam/5, 0.6, 7, 0.6, 20,130,20
arbusto4 29, 5, 35, 70, $tam, 0.45, 7, 0.0, 0,80,0

##Fila 7
arbusto2  0, 6, 30, 30, $tam, 0.4, 7, 40,115,65
arbusto4  2, 6, 85, 45, 3*$tam/2, 0.3, 6, 0.4, 32,138,87
arbusto3  4, 6, 80, 80, 3*$tam/4, 0.5, 8, 0.0, 21,129,26
arbusto5  6, 6, 45, 30, $tam, 0.4, 6, 0.3, 0.4, 55,99,57
arbusto2  8, 6, 58, 28, 4*$tam/5, 0.6, 12, 87,138,32

arbusto4 22, 6, 20, 10, $tam, 0.6, 7, 0.3, 103,138,103
arbusto2 24, 6, 30, 30, 3*$tam/5, 0.6, 10, 56,112,56
arbusto3 26, 6, 21, 11, 4*$tam/5, 0.6, 8, 0.1, 101,153,46
arbusto3 29, 6, 70, 70, $tam, 0.5, 8, 0.0, 88,135,38

##Fila 8
arbusto4  0, 7, 23, 28, $tam, 0.4, 6, 0.6, 123,152,91
arbusto3  2, 7, 50, 50, $tam, 0.5, 8, 0.2, 45,75,13
arbusto3  5, 7, 10, 20, $tam, 0.6, 9, 0.4, 78,117,35
arbusto2  7, 7, 15, 25, 4*$tam/5, 0.6, 10, 111,168,50

arbusto3 24, 7, 10, 20, $tam, 0.6, 8, 0.4, 117,116,35
arbusto3 26, 7, 20, 23, $tam, 0.65, 9, 0.4, 37,117,35
arbusto5 28, 7, 25, 30, $tam, 0.3, 5, 0.2, 0.3, 96,127,32
arbusto4 30, 7, 35, 25, $tam, 0.5, 6, 0.7, 48,120,32

##Fila 9
arbusto5  2, 9, 25, 30, 2*$tam, 0.5, 7, 0.4, 0.4, 0,127,64
arbusto2  6, 9, 20, 10, $tam/2, 0.9, 11, 0,102,51
arbusto5 12, 9, 48, 52, 3*$tam/2, 0.4, 7, 0.2, 0.5, 123,152,91

arbusto3 18, 9, 48, 52, $tam, 0.6, 10, 0.6, 45,75,13
arbusto2 24, 9, 15, 10, 2*$tam/5, 0.95, 11, 111,168,50
arbusto5 28, 9, 40, 30, 7*$tam/4, 0.5, 7, 0.3, 0.4, 64,127,64

##Ceiba grande
arbusto3 15, 9, 90, 90, 4*$tam, 0.5, 9, 0.0, 0,40,0

No hay comentarios:

Publicar un comentario