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 🙏

© 2026 – Pkg Stats / Ryan Hefner

space-colonization

v0.2.0

Published

space colonization algorithm

Downloads

12

Readme

space-colonization

unstable

alt text

Algorithm for tree-like and bush-like objects. Based on this paper.

Usage

$ npm i -S space-colonization

iterate = space-colonization(opts)

Options:

  • buds: array of buds position in the format [x, y, z]. This is where your tree is going to grow from
  • hormones: array of hormones (aka attractors) in the format [x, y, z]. Read the paper for more info on what they are. But simply put, they attract the branch to grow towards them. Can be randomly generated, for more sophisticated type of trees you can generate points inside a crown-like shape. More examples on how to do this will be added soon.
  • deadZone: the radius of which hormones are killed after each iteration. read the paper for more info. defaults to 0.1
  • growthStep: how far a branch can jump on each iteration. defaults to 0.3
  • splitChance: how likely it is to split on each iteration. defaults to 0.4
  • viewAngle: the angle at which an alive bud (the tip of a growing branch) can see hormones. defaults to 30 (measured in degrees)
  • viewDistance: how far the alive bud can see hormones. defaults to 0.5
  • branchAngle: when a split happens, how far the two new branches bend away from each other. defaults to 30 (measured in degrees)
  • straightSplit: if true, only new branch bends to the branchAngle. if false, both old and new branches bend (i. e. you get a V-like shape)

These numbers (except the angles) assume the buds and hormones have a distance between them in the same range (e.g. from 0 to 5). If you provide positions that have a range of 10-50 for example nothing will grow because the viewDistance is too small for the initial bud to see anything!

When you call the above function you get back an iterate function. This function can be called every frame to grow the tree until all hormones are dead or all buds die before they eat all possible hormones. The result of each call is an object with two properties:

  • buds: an array of buds with each bud an object with properties:
    • state: 0 for alive, 1 for dead
    • position: [x, y, z]
    • parentIndex: the index of the parent bud in the buds array. -1 if no parent
  • hormones: an array of hormones with each hormone an object with two properties:
    • state: 0 for alive, 1 for dead
    • position: [x, y, z]

More info and examples will be coming soon. Post an issue if anything is unclear. See example.js for basic usage with regl.

License

MIT