Documentation ¶
Overview ¶
Package sierpinski produces the vertices of a space-filling Sierpinski curve.
Index ¶
Constants ¶
const ( S = Orientation(iota) // XY -> XY. R // XY -> YXn. P // XY -> YnX. Z // XY -> XnYn. )
An orientation of the basic motif.
For a detailed explanation of these orientations see (Bader 80).
- (Bader 80). Bader, Michael. Space-Filling Curves, An Introduction with Applications in Scientific Computing. Springer. 2013.
const ( A = Region(iota) B C D E F G H )
= \ C | B / = \ | / = D \ | / A = - - - - -|- - - - - = E / | \ H = / | \ = / F | G \
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CurvePath ¶
type CurvePath [4]struct { Region Orientation }
CurvePath through the sub regions.
The curve path progresses through the indices in increasing order: 0, 1, 2, 3.
func Magnify ¶
func Magnify(ori Orientation) CurvePath
Magnify a section of the curve which consists of the basic motif with the given orientation.
type CurveRegion ¶
type CurveRegion struct { MidHypot maf.Vec // The midpoint of the region's hypotenuse. HalfHypot float64 // Half the length of the hypotenuse of the region. Ori Orientation // The orientation of the region's basic motif. }
CurveRegion of a Sierpinski curve.
Each curve region consists of a right isosceles divided into four right isosceles.
func (CurveRegion) SubRegions ¶
func (q CurveRegion) SubRegions() [4]CurveRegion
SubRegions of the receiver region in order of the direction of the curve through the sub regions.
func (CurveRegion) Vertices ¶
func (reg CurveRegion) Vertices() [4]maf.Vec
Vertices of the curve in the region in the order of the curve's path through the region.
type PlotSpec ¶
type PlotSpec struct { // Centre of the 2D square region occupied by the Sierpinski curve. // // The vertices of the curve will be in a plane parallel to the Z=0 plane. Centre maf.Vec // Iterations of the magnification process applied to the basic motif. // // The number of iterations does not equal the order of the curve because // the algorithm skips every other order of the curve. Iterations int // Width of the 2D square region occupied by the Sierpinski curve. W float64 }
PlotSpec specifies the properties of a Sierpinski curve.