A package for creating and drawing trees
Project description
Python package, which you can use to generate and drawing trees, realistic or fractal ones.
Usage
$ pip install Tree
from math import radians
from PIL import Image
from Tree.core import Tree
from Tree.draw import PillowDrawer
if __name__ == "__main__":
# Create a Tree
my_tree = Tree(
pos = (0, 0, 0, -200),
branches=[
[0.5, rad(0)],
[0.5, rad(120)],
[0.5, rad(240)],
],
sigma = (0.2, 5/180)
)
my_tree.grow(times=12)
# Move the tree in the right position, so that the tree is completly in the image
rec = my_tree.move_in_rectangle()
# Create a image with the dimensions of the tree
im = Image.new("RGB", my_tree.get_size())
# Draw the tree on the image
PillowDrawer(my_tree, im, (203, 40, 12)+(23, 90, 123), 10).draw()
# Show the tree
im.show()
Documentation
The documentation is hosted on Readthedocs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Tree-0.2.3.tar.gz
(6.2 kB
view hashes)
Built Distribution
Tree-0.2.3-py2.py3-none-any.whl
(14.7 kB
view hashes)