{"id":19764267,"url":"https://github.com/theobori/lindermayer","last_synced_at":"2026-03-01T23:31:39.851Z","repository":{"id":159533847,"uuid":"523470892","full_name":"theobori/lindermayer","owner":"theobori","description":"🌱 Build recursive images (fractals, plants, etc..), supporting multiple graphic APIs to build an SVG","archived":false,"fork":false,"pushed_at":"2023-05-05T18:55:58.000Z","size":1359,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T14:33:26.326Z","etag":null,"topics":["grammar","graphics","l-systems","library","lindermayer","rust","svg"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/lindenmayer_graphic","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theobori.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-10T19:24:01.000Z","updated_at":"2024-10-09T16:58:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"faafee8e-043d-4e45-b57c-4f7c4739dbb6","html_url":"https://github.com/theobori/lindermayer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theobori/lindermayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theobori%2Flindermayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theobori%2Flindermayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theobori%2Flindermayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theobori%2Flindermayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theobori","download_url":"https://codeload.github.com/theobori/lindermayer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theobori%2Flindermayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29987698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T22:42:38.399Z","status":"ssl_error","status_checked_at":"2026-03-01T22:41:51.863Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grammar","graphics","l-systems","library","lindermayer","rust","svg"],"created_at":"2024-11-12T04:12:59.012Z","updated_at":"2026-03-01T23:31:39.847Z","avatar_url":"https://github.com/theobori.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lindenmayer system\n\nThe renderer named `Renderer::TurtleNormal` doesn't have headless mode, it means during the execution you will see the entire rendering process (turtle traces). Instead you could use `Renderer::TurtleHeadless` if you only need an output file.\n\n## How to build and run ?\n\n1. Install the dependencies\n    - `cargo`\n\n## Usage examples\n\n### Plant\n\n```rust\nuse lindenmayer_graphic::{\n    lindenmayer::Lindenmayer,\n    models::{\n        rules_model::Rules,\n        action_model::Action\n    },\n    action::Do,\n    renders::renderer::Renderer,\n    state::{\n        ScreenPosition,\n        SizeType\n    }\n};\n\nfn main() {\n    let renderer = Renderer::TurtleHeadless(SizeType::Auto);\n\n    Lindenmayer::new(renderer)\n        .set_consts(\"c+-[]\")\n        .set_rule('X', \"cF+[[X]-X]-cF[-cFX]+X\")\n        .set_rule('F', \"cFcF\")\n        .set_action('F', Do::Forward(10.0))\n        .set_action('[', Do::Save)\n        .set_action(']', Do::Restore)\n        .set_action('-', Do::Right(25.))\n        .set_action('+', Do::Left(25.))\n        .set_action('c', Do::ColorRandom)\n        .set_axiom(\"+++cX\")\n        .set_figure_pos(ScreenPosition::Center)\n        .set_background(0., 0., 0.)\n        .iterate(6)\n        .draw()\n        .save_svg(\"img/plant.svg\");\n}\n```\n\n### Result\n\n![Plant](img/plant.svg)\n\n### Stochastic plant\n\n```rust\nuse std::fmt::format;\n\nuse lindenmayer_graphic::{\n    lindenmayer::Lindenmayer,\n    models::{\n        rules_model::Rules,\n        action_model::Action\n    },\n    action::Do,\n    renders::renderer::Renderer,\n    state::{\n        ScreenPosition,\n        SizeType\n    },\n    rule::Rule\n};\n\nfn tree(output: \u0026str) {\n    let renderer = Renderer::TurtleHeadless(SizeType::Auto);\n\n    Lindenmayer::new(renderer)\n        .set_consts(\"cgy+-[]\")\n        .set_rule(\n            'X',\n            vec![\n                Rule::new(\"cF+[[X]-X]-gF[-cFX]+X\", 33),\n                Rule::new(\"gF-[[X]+X]+cF[+gFX]-X\", 33),\n                Rule::new(\"yF-[[X]+X]+cF[+yFX]-X\", 33)\n            ]\n        )\n        .set_rule('F', \"cFcF\")\n        .set_action('F', Do::Forward(10.0))\n        .set_action('[', Do::Save)\n        .set_action(']', Do::Restore)\n        .set_action('-', Do::Right(25.))\n        .set_action('+', Do::Left(25.))\n        .set_action('g', Do::PenColor(0., 150., 0.))\n        .set_action('y', Do::PenColor(150., 150., 0.))\n        .set_action('c', Do::PenColor(50., 50., 50.))\n        .set_axiom(\"+++cX\")\n        .set_figure_pos(ScreenPosition::Center)\n        .set_background(0., 0., 0.)\n        .iterate(6)\n        .draw()\n        .save_svg(output);\n}\n\nfn main() {\n    for i in 0..5 {\n        let name = format!(\"tree_{}.svg\", i);\n    \n        tree(\u0026name);\n    }\n}\n\n```\n\n### Results\n\n![Plant 1](img/tree_0.svg)\n![Plant 1](img/tree_1.svg)\n![Plant 1](img/tree_2.svg)\n![Plant 1](img/tree_3.svg)\n![Plant 1](img/tree_4.svg)\n\n### Dragon\n\n```rust\nuse lindenmayer_graphic::{\n    lindenmayer::Lindenmayer,\n    models::{\n        rules_model::Rules,\n        action_model::Action\n    },\n    action::Do,\n    renders::renderer::Renderer,\n    state::{\n        ScreenPosition,\n        SizeType\n    }\n};\n\nfn main() {\n    let size = SizeType::Custom(400., 400.);\n    let renderer = Renderer::TurtleHeadless(size);\n\n    Lindenmayer::new(renderer)\n        .set_consts(\"c+-\")\n        .set_rule('F', \"F+G\")\n        .set_rule('G', \"F-G\")\n        .set_action('F', Do::Forward(5.0))\n        .set_action('G', Do::Forward(5.0))\n        .set_action('-', Do::Right(90.))\n        .set_action('+', Do::Left(90.))\n        .set_action('c', Do::ColorRandom)\n        .set_axiom(\"cF\")\n        .set_figure_pos(ScreenPosition::Center)\n        .set_background(0., 0., 0.)\n        .iterate(13)\n        .draw()\n        .save_svg(\"img/dragon.svg\");\n}\n```\n\n### Result\n\n![Dragon](img/dragon.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheobori%2Flindermayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheobori%2Flindermayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheobori%2Flindermayer/lists"}