npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

virtual_botanical_laboratory

v0.0.2

Published

A virtual botanical laboratory

Downloads

72

Readme

Introduction

A while back I was reading Artificial life. A report from the frontier where computers meet biology (Levy 1992). In this book, Levy describes the development of the scientific field of artificial life till the 1990s. Although I think the book was less readable than his work Hackers (Levy 2010), it was still an interesting read. What piqued my interest most in Levy’s book on artificial life was the idea of generating plant-like structures by means of a rewriting system known as an L-system.

In the notes to the Chapter Artificial flora, artifical fauna, artificial ecologies I found a reference to a book called The algorithmic beauty of plants (Prusinkiewicz and Lindenmayer 1990). Given its age, I had little hope in finding this book. To my surprise, it is available on-line! (Warning, this is a 17Mb PDF; see http://algorithmicbotany.org/papers/#abop for smaller versions.)

I downloaded the book and started reading it. Chapter 1 is introductory material introducing the L-system formalism, its extensions, and a way to render these L-systems. The authors render the L-systems by interpreting it in terms of turtle graphics. Turtle graphics is quite a simple way of thinking about drawing things with a computer: given a turtle holding a pen, tell the turtle where to move, to rotate, and to push the pen to the paper or not.

Seeing the turtle interpretation, I tried to read (Prusinkiewicz and Lindenmayer 1990) using a constructionist approach by building the examples myself. After a couple of fun hours programming these prototypes, I decided to write my own virtual botanical laboratory because I assumed that the software described in The algorithmic beauty of plants would not exist anymore. Later, when I had finished most of the engine of my virtual botanical laboratory, I discovered that the group who put the book on-line also have put their software on-line as well.

How much fun: I generated an odd looking
tree!

Then again, building my own laboratory probably deepened my understanding of the material I would not have reached by using the available software. Here I present my own virtual botanical laboratory that I unoriginally named virtual_botanical_laboratory. Feel free to use is to explore the book The algorithmic beauty of plants yourself, use it to generate your own plant-like shapes, or just have fun with it! (For example, look at that odd looking tree I generated above :-))

Running the virtual_botanical_laboratory

To run the virtual_botanical_laboratory, you need to:

  • include dist/virtual_botanical_laboratory.js in your HTML file. For example in the HEAD like:

    <!DOCTYPE html>
    <html>
        <head>
            <script src="dist/virtual_botanical_laboratory.js"></script>
  • create a LabView and configure it. For example:

    <figure id="lab"></figure>
    <script>
        new virtual_botanical_laboratory.LabView("#lab", {
            lsystem: `simple_tree = lsystem(
                description: "Simple growing tree",
                alphabet: {F, O, I, -, +},
                axiom: F I F I F I,
                productions: {
                    O < O > O -> I,
                    O < O > I -> I [ - F I F I ],
                    O < I > O -> I,
                    O < I > I -> I,
                    I < O > O -> O,
                    I < O > I -> I F I,
                    I < I > O -> I,
                    I < I > I -> O,
                    + -> -,
                    - -> +
                },
                ignore: {+, -, F}
            )`,
            interpretation: {
                config: {
                    x: 200,
                    y: 500,
                    width: 600,
                    height: 500,
                    d: 10,
                    delta: (-22.5 * Math.PI)/180,
                    alpha: (270 * Math.PI)/180,
                    close: false,
                    derivationLength: 24,
                    animate: false,
                    "line-width": 2,
                    "line-color": "#4E9C25"
                }
            }
        });
    </script>
  • and open the HTML file in a modern web browser!

For more examples, please see the examples.

For more information about creating and configuring L-systems, see the chapters below. For more information about virtual_botanical_laboratory, I refer you to its manual.

License

virtual_botanical_laboratory is free software; virtual_botanical_laboratory is released under the GPLv3. You find virtual_botanical_laboratory’s source code on github.

Developing virtual_botanical_laboratory

Note. The virtual_botanical_laboratory is quite SPACE inefficient. This is fine for the prototype it is now, but this issue needs to be addressed when continuing the project.

If you plan on extending or adapting the virtual_botanical_laboratory, see the API documentation.

Building

  • To build the virtual_botanical_laboratory, run

    npm install
    npm run build
  • To generate the API documentation, run

    npm run doc
  • To generate the manual you need pandocomatic and Bash, run

    ./generate_documentation.sh

Todo

The virtual_botanical_laboratory is still a work in progress. With the current version you can explore much of the material in the book The algorithmic beauty of plants (Prusinkiewicz and Lindenmayer 1990). Some more advanced features from later in that book needs to be implemented still.

The following list of features and improvements are still to do:

  • L-system language:

    • Importing other l-systems
    • & operator
    • Other stuff from later in the book
    • Derive a successor in a separate (worker) thread
  • Interpretation:

    • Rendering 3D interpretations
  • An improved user interface. The current interface is just a placeholder. Enough to configure and experiment with l-systems, but in not user-friendly. Feel free to replace it with something better, pull requests are welcome!

    • make derivation and rendering cancellable.

References

Levy, Steven. 1992. Artificial Life. A Report from the Frontier Where Computers Meet Biology. New York: Vintage books.

———. 2010. Hackers. Sebastopol: O’Reilly.

Prusinkiewicz, Prezemyslaw, and Aristid Lindenmayer. 1990. The Algorithmic Beauty of Plants. New York: Springer-Verlag. http://algorithmicbotany.org/papers/#abop.