package ifs-fractals
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
IFS fractals (the Barnsley fern and friends) drawn with the chaos game
Install
dune-project
Dependency
Authors
Maintainers
Sources
v1.2.0.tar.gz
md5=d40602261f2f6e005278ca546e37b640
sha512=adf4d4a25a86a8d0041d6677dd26a21f4f97d7523f00b4b6037c8e73981e259fa763c682e8fedb5597ce3908a8c400ab2f872c745ef6274c413161d1dfc3d7d5
doc/CHANGES.html
1.2.0 (2026-08-23)
- API documentation, published at https://ocaml.org/p/ifs-fractals and built locally with
dune build @doc. The library has an interface file,lib/ifs_fractals.mli, in which every type, function and predefined fractal carries a documentation comment, anddoc/index.mldis the landing page of the package. The interface also settles what the library actually offers: the plumbing of the PNG writer (output_png,add_chunk,crc_table,encode,ramp_color) and of the Fractint reader (words,group_entries,thresholds,cumulate, ...) is no longer exported, along withselect_image,pixel_of_point,accumulateandviewport. Everything the command and the documented API use is unchanged. - Fixed:
sierpinskidrew an empty window andkocha speck in the middle of one. Both had their coefficients written in the order of a Fractint table —a b c d e fforx' = a*x + b*y + e— rather than the order ofkf, so neither described the fractal it was named after, and neither landed in the region its record asked to display. The transforms are reordered and both viewports now frame the attractor:sierpinskiis the triangle on (0,0), (2,0), (1, √3), andkochthe curve from (0,0) to (1,0). This had been the case since the first commit, in 2010. - A test suite, run with
dune test: the affine maps and the projection, the chaos game, the framing of an attractor, the Fractint parser and the errors it reports, and the PNG writer, whose output is decoded and checked rather than counted in bytes. It needs no display and no new dependency. - The predefined fractals moved out of
lib/ifs_fractals.mlinto their ownlib/fractals.ml, together with thepoint,transfoandifstypes, so that adding or tuning a fractal no longer touches the code that draws it.Ifs_fractalsre-exports them, so the library API is unchanged, and so is the toplevel workflow (the loader now uses#mod_usefor the new file). show fs ndraws a fractal, waits for a keypress and closes the window. Unlikedraw, it leaves the program inside an event call, which is what lets the window manager's close button work.- Fixed: after the graphics window was closed — by
Graphics.close_graphor by the window manager —drawfailed withGraphic_failure "graphic screen not opened"instead of opening a new window.window_openis now a function that asks the graphics library rather than a stale flag. - Fractals can be read from Fractint
.ifsfiles:ifs-fractals -f FILE.ifs NAMEfrom the command line,load_fractintfrom the library. The format's plain weights are converted to cumulative thresholds (or derived from each map's determinant when the file gives none), and the viewport, which the format does not record, is fitted to the attractor byfit.example/classics.ifscollects a dozen classic systems to try it on. - Three-dimensional systems — Fractint's
(3D)entries, twelve or thirteen numbers per transform — are read and drawn as well, projected orthographically from a direction given by-v YAW,PITCHin degrees (?yawand?pitchin the library). Reading a file now returns asystem, eitherFlat of ifsorSolid of ifs3;draw_system,show_systemandsave_png_systemtake either.
1.1.0 (2026-08-05)
- Fractals can now be rendered to PNG files without a graphical display:
ifs-fractals -o fern.png barnsleyfrom the command line (with an optional-s WIDTHxHEIGHT), orsave_pngfrom the library. The PNG writer is self-contained — no new dependency. - Density coloring: with
-c(orsave_png ~color:true), pixels are colored by how often the chaos game visits them, on a log scale from light green to dark blue.
1.0.0 (2026-07-27)
First release on opam, sixteen years after the first commit.
- Packaged with dune: the code now builds as a library (
ifs-fractals, moduleIfs_fractals) and anifs-fractalscommand-line executable. - The historical toplevel workflow (
#use "ifs_fractals.ml";;) still works from a clone of the repository. - Sixteen predefined fractals, including the five added in 2026:
maple,fiddlehead,vegvisir,sunflowerandlace.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>