Line Patterns

This page started out a long time ago as a test for the Python code to draw lines into a bitmap structure. This iteration is written in Javascript and uses the HTML canvas to render the patterns.

The patterns on this page are created by defining a number of dots evenly around a circle and then connecting them with straight lines. The different patterns are created by varying the number of points and the algorithm for deciding which points to join. Currently there are three algorithms:

Star: This has two parameters, the number of points (n) and the step size (m). We start with the first point (0) and advance 'm' points to the next (m) and draw a line, we then move to 2m and draw again. we continue this until we return to the original point.
Graph: This has one parameter, the number of points (n). We join every point to every other point.
Powers: This has two parameters, the number of points (n) and the multiplier (m). We start at the second point (1) and repeatedly multiply by 'm' until we return to the starting point.
Powers-full: Fills in the missing lines from the "Powers" pattern.
Star-Spiral: Draws a star (as above), but shrinks towards the centre as it goes around. Multiple laps create a spiral effect.
Star-Rotate: Draws multiple copies of a star, each one shrunk and rotated.

Pattern: N: M:

Spiral Factor (%): Laps (%):

Rotate (deg): Shrink (%): Repeat:

Colours Range: Start: End: Back:

Animation

This is an animation of the complete graphs 3-29 generated using using examples 2-29 in the Python code linked below.

The Line Patterns Python Module

The line pattern module was developed mainly as a test for the line drawing algorithm. The module comes with an example function that draws patterns like these below.

Eaxmples 1-50 draw what are known as complete graphs (the graph obtained by joining every point in a set to every other point). You can read more about these at Wolfram Research's Mathworld. The first image below is the complete graph for 10.

Passing a tuple such as (11,4) to the 'example' method will draw a star. The second image is the (11,4) star, it has eleven points with the edges joining every 4th point.

The third and fourth images are examples 100 and 100 respectively third and fourth images are generated by superimposing sets of stars and show the sets based on (5,2) and (7,1), with varying phases and sizes.

The source for these patterns can be downloaded from the source code page.

Other pages

(c) John Whitehouse 2010 - 2020