LINDENMAYER
Biblioteca para generar fractales con L-systems y tortuga gráfica en Python.
Licencia: GNU GPLv3
🌿 VIVA PALESTINA LIBRE
LINDERMAYER permite crear y visualizar fractales clásicos y personalizados usando sistemas de Lindenmayer (L-systems) y una tortuga gráfica basada en matplotlib.
Incluye fractales predefinidos listos para usar:
arboleo→ árbol fractal simplesnowflake→ curva de Koch (copo de nieve)dragon→ curva del dragónkoch→ curva de Koch básica
Instalación
Desde Test PyPI:
pip install --index-url https://test.pypi.org/simple/ LINDERMAYER
Instalación local editable:
## Fractales predefinidos
from lindermayer import arboleo, snowflake, dragon, koch
# Curva de Koch básica
koch.plt(n=6)
# Árbol fractal simple
arboleo.plot(n=3)
# Curva del Dragón
dragon.plot(n=12)
# Copo de nieve
snowflake.plot(n=6)
# Función generar_fractal
generar_fractal
La función generar_fractal permite construir y dibujar fractales definidos mediante L-systems (Lindenmayer systems) usando una tortuga gráfica.
Definición
generar_fractal(V, P, omega, angle, step, n)
Descripción
Esta función:
Construye un sistema de Lindenmayer (L-system)
Aplica las reglas de producción n veces
Interpreta la cadena resultante con una tortuga gráfica
Muestra el fractal usando matplotlib
Parámetros
V — Alfabeto del sistema
Conjunto de símbolos válidos del L-system.
V = {'F', '+', '-'}
No todos los símbolos necesariamente dibujan; algunos solo controlan el comportamiento.
P — Reglas de producción
Diccionario que define cómo se reescribe cada símbolo.
P = {
'F': 'F+F--F+F'
}
Cada iteración sustituye los símbolos según estas reglas.
omega — Axioma (estado inicial)
Cadena inicial del sistema antes de aplicar las reglas.
omega = 'F'
angle — Ángulo de giro
Ángulo en radianes usado por la tortuga para rotaciones.
Ejemplos comunes:
pi/2 # 90°
pi/3 # 60°
pi/4 # 45°
step — Tamaño del paso
Longitud del movimiento hacia adelante de la tortuga.
step = 1
Controla la escala del fractal.
n — Número de iteraciones
Cantidad de veces que se aplican las reglas de producción.
n = 5
Más iteraciones → mayor detalle → mayor costo computacional.
Comportamiento de los símbolos (Tortuga)
Por convención:
Símbolo Acción
F Avanzar dibujando
f Avanzar sin dibujar
+ Girar a la derecha
- Girar a la izquierda
(Esto depende de la implementación de la clase Tortuga.)
Ejemplo
Curva de Koch:
from lindenmayer.funcion_lindermayer import generar_fractal
from math import pi
V = {'F', '+', '-'}
omega = 'F'
P = {
'F': 'F+F--F+F'
}
generar_fractal(V, P, omega, angle=pi/3, step=1, n=4)
Notas
Iteraciones grandes pueden generar cadenas muy largas
El tiempo de dibujo crece rápidamente con n
El ángulo incorrecto produce geometrías inesperadas
Metadata
Release files for lindenmayer-fractals 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lindenmayer_fractals-1.1.1.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lindenmayer_fractals-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / lindenmayer_fractals-1.1.1.tar.gz
| Download URL | lindenmayer_fractals-1.1.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6aa819a35ca4aeff77722dd55c9b15199b5b4dcf35d026f5069c25ad82e75ece
|
|
BLAKE2b-256 checksum How to use checksums |
b73c97ae10110bd5a5abe6f0f3a516e7be22a88917bf82a7e08b24412f3b8ae7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / lindenmayer_fractals-1.1.1-py3-none-any.whl
| Download URL | lindenmayer_fractals-1.1.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67682a4bb6ba1ea9c5fdc0e48ceb3b545f2da7fcf32a27c5083e82dba06c8b70
|
|
BLAKE2b-256 checksum How to use checksums |
46c10072f58e8a133dcbb50e3169543d8272a67bdeb7d19f3d62c979643bf1e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for lindenmayer-fractals 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.