Skip to main content

A simple library for drawing IFS fractals and fractal-flames

Project description

Fracted

A simple python library for IFS fractals and fractal flames.

It allows you to render fractals as numpy arrays. Then, you can analyze it, display it using matplotlib or save as image with Pillow.

Installation

Install using pip:

pip install fracted

or clone this repo:

git clone https://github.com/Skrret/fracted

and install in editable mode:

cd fracted
pip install -e .

Usage

from fracted import fractals

Serpinski Triangle

transformations = [
    (lambda point: (point[0] / 2 + 100 * 3 ** 0.5, point[1] / 2)),
    (lambda point: (point[0] / 2, point[1] / 2 + 100)),
    (lambda point: (point[0] / 2, point[1] / 2 - 100)),
]
frac = fractals.IFS(
    transformations,
    min_x=0,
    min_y=-200,
    max_x=400,
    max_y=200,
)
plt.imshow(frac.draw(20, 50_000))
plt.show()

Serpinski triangle

Fractal Flames

Fracted can be also used to generate fractal flames.

transformations = [
    (
        lambda point: (
            0.8 * point[0] + 0.5 * numpy.cos(point[1]) - 3,
            0.8 * point[1] + 0.5 * numpy.cos(point[0]) - 3,
        )
    ),
    (
        lambda point: (
            -0.5 * point[1] + 0.5 * abs(point[0]) ** 0.5 + 1,
            0.5 * point[0] + 0.5 * abs(point[0]) ** 0.5 + 3,
        )
    ),
]
frac = fractals.IFS(
    transformations, resolution=50, min_x=-10, min_y=-10, max_x=10, max_y=10
)
plt.imshow(numpy.log10(frac.draw(20, 50000)))
plt.show()

Fractal flame

More examples are in examples/.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fracted-0.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fracted-0.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file fracted-0.0.0.tar.gz.

File metadata

  • Download URL: fracted-0.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fracted-0.0.0.tar.gz
Algorithm Hash digest
SHA256 f1540c2f35cc793d2eee61abe68feea1cd58d2e9d4eadb9860a77fe160400b74
MD5 a9e5f8762a7f70a504cdc4fa9890f18b
BLAKE2b-256 90b11cd5895a47d1948b576b3f4a1f7f234072e1761e2bd06ddbbf88ad93c313

See more details on using hashes here.

File details

Details for the file fracted-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: fracted-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fracted-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 987854bd3a1e7c025b92a87051fb9b50b799036c1150c1d3687d10b0b9722af3
MD5 128b6f47870c847577f88a1e419eb8f4
BLAKE2b-256 0410a4be7bb624fa9e3028015d5ba671fd0f20b78785e9c5c8972c00097935d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page