fractal

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDragon

func GenerateDragon(level int, instructions chan<- turtle.Instruction, forward float64)

Generate instructions to draw a dragon curve.

https://en.wikipedia.org/wiki/Dragon_curve https://en.wikipedia.org/wiki/L-system#Example_6:_Dragon_curve

func GenerateHilbert

func GenerateHilbert(level int, instructions chan<- turtle.Instruction, forward float64)

Generate instructions to draw a Hilbert curve, with the requested recursion level, receiving Instruction on the channel instructions.

The channel will be closed to signal the end of the stream.

For more information: https://en.wikipedia.org/wiki/Hilbert_curve#Representation_as_Lindenmayer_system

func GenerateSierpinskiArrowhead

func GenerateSierpinskiArrowhead(level int, instructions chan<- turtle.Instruction, forward float64)

Generate instructions to draw a Sierpinski arrowhead curve.

https://en.wikipedia.org/wiki/Sierpi%C5%84ski_curve#Arrowhead_curve

func GenerateSierpinskiTriangle

func GenerateSierpinskiTriangle(level int, instructions chan<- turtle.Instruction, forward float64)

Generate instructions to draw a Sierpinski triangle.

https://en.wikipedia.org/wiki/L-system#Example_5:_Sierpinski_triangle

func Instructions

func Instructions(
	level int,
	instructions chan<- turtle.Instruction,
	remaining string,
	rules map[byte]string,
	angle float64,
	forward float64,
) string

Generate instructions for a general Lindenmayer system.

level: recursion level to reach. instructions: channel where the instructions will be sent. remaining: set to the axiom. rules: production rules. angle: how much to rotate. forward: how much to move forward.

Two mildly different rewrite rules can be used: using ABCD, the forward movement must be explicit, using an F. using XYWZ, the forward movement is done when the base of the recursion is reached.

https://en.wikipedia.org/wiki/L-system

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL