tFixed comment, added radius argument to regular_star_polygon - polygen - generative drawing of polygonal patterns
(HTM) git clone git://src.adamsgaard.dk/polygen
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 053bdd1f0f6de85c1c939354b601a216d74071e8
(DIR) parent e8516738e741fb59a6391f06af29a5b68542cacd
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Fri, 14 Mar 2014 13:12:07 +0100
Fixed comment, added radius argument to regular_star_polygon
Diffstat:
M README.rst | 3 ++-
M decagon.py | 2 +-
M polygen.py | 7 +++++--
3 files changed, 8 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/README.rst b/README.rst
t@@ -19,7 +19,8 @@ Examples
:align: center
-``python octahedron.py``
+``python octahedron.py``.
+Inspired by a polygon in the music video for Volto! - Tocino.
.. image:: octahedron.png
:scale: 60%
(DIR) diff --git a/decagon.py b/decagon.py
t@@ -11,7 +11,7 @@ p = polygen.polyplot()
# Pass the decagon points to the plot object
p.set_points(decagon.points)
-# Plot decagon, do not draw lines to opposite points. Use custom colors.
+# Plot decagon. Use custom line color.
p.plot_all_to_all(line_width=2, line_color='#666666')
# Save figure as file
(DIR) diff --git a/polygen.py b/polygen.py
t@@ -12,6 +12,9 @@ class polyplot:
def set_points(self, points):
self.points = points
+ def add_points(self, points):
+ self.points = numpy.concentrate((self.points, points), axis=0)
+
def plot_all_to_all(self, line_color='black', line_width=2,
line_style='solid',
figure_size_inches=(8,8),
t@@ -53,14 +56,14 @@ class polyplot:
class regular_star_polygon:
- def __init__(self, n=5):
+ def __init__(self, n=5, radius=1.0):
if n < 3:
raise Exception('regular_star_polygon: Error, this function ' +
'doesn\'t work with n < 3.')
self.n = n
- self.generate_regular_star_polygon()
+ self.generate_regular_star_polygon(radius=radius)
def generate_regular_star_polygon(self, radius=1.0):
self.points = numpy.empty((self.n, 2))