Documentation ¶
Overview ¶
Package chapter3 provides utilities for mandelbrot and surface plots.
Index ¶
- Constants
- func Egg(x, y float64) float64
- func EggHandlerSVG(w io.Writer)
- func MBGraphBWHandler(w http.ResponseWriter, _ *http.Request)
- func MBGraphHandler(w http.ResponseWriter, _ *http.Request)
- func PlotOn3DSurface(w io.Writer, plot func(float64, float64) float64)
- func Sinc(x, y float64) float64
- func SincSVG(w io.Writer)
- func Squares(x, y float64) float64
- func SquaresHandlerSVG(w io.Writer)
- func Valley(x, y float64) float64
- func ValleyHandlerSVG(w io.Writer)
- type MandelbrotImage
Constants ¶
View Source
const ( // MBXMin is lower bound of x value for MB (Mandelbrot Set) MBXMin = -2 // MBXMax is upper bound of x value for MB (Mandelbrot Set) MBXMax = 2 // MBYMin is lower bound of y value for MB (Mandelbrot Set) MBYMin = -2 // MBYMax is upper bound of y value for MB (Mandelbrot Set) MBYMax = 2 // MBWidth pixels wide (along x-axis) MBWidth = 1024 // MBHeight pixels high (along y-axis) MBHeight = 1024 // MBContrast contrast desired MBContrast = 100 // MBSubPixels number of pixels to take average for super aliasing MBSubPixels = 4 // MaxGoRoutines for concurrency MaxGoRoutines = 32 )
Mandelbrot Set Graph constants
View Source
const ( // SurfaceWidth width of #D surface plot SurfaceWidth = 1200 // SurfaceHeight Height of #D surface plot SurfaceHeight = 800 // SurfaceGridCells number of cells in a grid SurfaceGridCells = 50 // SurfaceXYRange of x-axis from -SurfaceXYRange .. +SurfaceXYRange SurfaceXYRange = 30.0 // SurfaceXYScale scaling x data to plot on graph SurfaceXYScale = SurfaceWidth / 2 / SurfaceXYRange // SurfaceZScale scaling x data to plot on graph SurfaceZScale = SurfaceHeight * 0.4 // SurfaceAngle30 at which x and y are angled SurfaceAngle30 = math.Pi / 6 // SVGPrefixFormat element prefix SVGPrefixFormat = `<svg xmlns="http://www.w3.org/2000/svg" style="stroke: grey; fill: white; stroke-width:0.7" width="100%%" height="100%%" viewBox="0 0 %d %d">` + "\n" // SVGSuffixTag closes <svg> ... </svg> SVGSuffixTag = "</svg>" )
Surface plot 3D (x,y,z) constants to plot on a 2-D graph
View Source
const ( EggDenominator = 10 SquaresDenominator = 5 )
Variables ¶
This section is empty.
Functions ¶
func MBGraphBWHandler ¶
func MBGraphBWHandler(w http.ResponseWriter, _ *http.Request)
MBGraphBWHandler in black
func MBGraphHandler ¶
func MBGraphHandler(w http.ResponseWriter, _ *http.Request)
MBGraphHandler returns a color image.
func PlotOn3DSurface ¶
PlotOn3DSurface plats z = f(x,y) as a wire on a 3-D mesh surface using SVG (Scalable Vector Graphics)
See SVG on https://www.w3schools.com/graphics/svg_intro.asp Example, makes a hexagon <svg width="100" height="100"> <polygon points="25,0 50,0 75,25 50,50 25,50 0,25" stroke="green" stroke-width="4" fill="yellow" /> </svg>
func Sinc ¶
Sinc sampling function returns 1 or sin r / r
https://mathworld.wolfram.com/SincFunction.html
func SquaresHandlerSVG ¶
SquaresHandlerSVG draws a sinc on a writer
func ValleyHandlerSVG ¶
ValleyHandlerSVG draws a Valley on a writer
Types ¶
type MandelbrotImage ¶
type MandelbrotImage int
const ( // MBBlackAndWhite draws MB in Black and White MBBlackAndWhite MandelbrotImage = iota MBColor )
Click to show internal directories.
Click to hide internal directories.