tAdded example of octahedron, added transparancy and line exception options - polygen - generative drawing of polygonal patterns
 (HTM) git clone git://src.adamsgaard.dk/polygen
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit ba5bec68d87be35cff72f57af2ea41062f9760ef
 (DIR) parent 8e8c544294a8b2ec72f4b64641d51f85eb690168
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Thu, 13 Mar 2014 21:15:49 +0100
       
       Added example of octahedron, added transparancy and line exception options
       
       Diffstat:
         A octahedron.py                       |      10 ++++++++++
         M polygen.py                          |      11 +++++++----
       
       2 files changed, 17 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/octahedron.py b/octahedron.py
       t@@ -0,0 +1,10 @@
       +#!/usr/bin/env python
       +
       +import numpy
       +import polygen
       +
       +octahedron = polygen.regular_star_polygon(8)
       +#octahedron = polygen.regular_star_polygon(3)
       +p = polygen.polyplot()
       +p.set_points(octahedron.points)
       +p.plot_all_to_all(line_width=4, exceptions=[[0,4], [1,5], [2,6], [3,7]])
 (DIR) diff --git a/polygen.py b/polygen.py
       t@@ -14,14 +14,16 @@ class polyplot:
        
            def plot_all_to_all(self, line_color='k', line_width=2,
                    image_name='all_to_all', image_format='png',
       -            figure_size=(8,8),
       +            figure_size=(8,8), transparent_background=True,
                    plot_points=False, points_style='wo',
       -            show_axes=False):
       +            show_axes=False, exceptions=[]):
                self.points = numpy.asarray(self.points)
                fig = plt.figure(figsize=figure_size)
                for i in range(self.points.shape[0]):
                    for j in range(self.points.shape[0]):
       -                if (i != j):
       +                if (i != j and
       +                        ([i,j] in exceptions) == False and
       +                        ([j,i] in exceptions) == False):
                            plt.plot([self.points[i,0], self.points[j,0]],
                                    [self.points[i,1], self.points[j,1]],
                                    line_color + '-', lw=line_width)
       t@@ -30,7 +32,8 @@ class polyplot:
                plt.axis('equal')
                if (show_axes == False):
                    plt.axis('off')
       -        fig.savefig(image_name + '.' + image_format)
       +        fig.savefig(image_name + '.' + image_format,
       +                transparent=transparent_background)
                fig.clf()
        
        class regular_star_polygon: