Python_2  1.0
Functions
_16_sierpinski_arrowhead Namespace Reference

Draws a Sierpinski arrowhead curve. More...

Functions

def Sierpinski_arrowhead_curve (order, length)
 Creates a Sierpinski Arrowhead curve, by recursively breaking an initial line, starting at a given point, into three new segments. More...
 
def draw (c, points, contour=False)
 Draw lines, given in points, on canvas c. More...
 
def main (argv=None)
 Main program. More...
 

Detailed Description

Draws a Sierpinski arrowhead curve.

Usage: _16_sierpinski_arrowhead [number_of_divisions]

Author
Paulo Roma Cavalcanti
Since
22/01/2017
See also
http://paulbourke.net/fractals/gasket/
https://en.wikipedia.org/wiki/Sierpinski_triangle
http://ecademy.agnesscott.edu/~lriddle/ifs/siertri/siertri.htm
http://www.oftenpaper.net/sierpinski.htm
https://code.activestate.com/recipes/580614-sierpinski-gasket/

Function Documentation

◆ draw()

def _16_sierpinski_arrowhead.draw (   c,
  points,
  contour = False 
)

Draw lines, given in points, on canvas c.

Referenced by main().

◆ main()

def _16_sierpinski_arrowhead.main (   argv = None)

◆ Sierpinski_arrowhead_curve()

def _16_sierpinski_arrowhead.Sierpinski_arrowhead_curve (   order,
  length 
)

Creates a Sierpinski Arrowhead curve, by recursively breaking an initial line, starting at a given point, into three new segments.

  • There will be:
    • \(3^{n}\) red triangles or
    • \(4^{n}\) if the fourth triangle is drawn.
  • The number of white triangles is a Geometric Progression, starting at 1 and with ratio 3, given by:
    • P(0) = 0
    • P(n) = 3 * P(n-1) + 1
    • P(n) = \(\frac{(3^n-1)}{2}.\)
Parameters
orderrecursion depth.
lengthinitial segment size.

Referenced by main().