Documentation ¶
Index ¶
- Variables
- func CheckIfChanges(expr string, functions mee.Functions) bool
- func CompileExpr(expr *mee.Expr, functions mee.Functions)
- type Line
- type Lines
- type Marble
- type Marbles
- type TrackingInfo
- type Vec2
- type World
- func (wd *World) CompileLines()
- func (wd *World) Graph()
- func (wd *World) GraphLines()
- func (wd *World) HandleError(err error) bool
- func (wd *World) NewLine(expr string, graphIf string, bounce string) *Line
- func (wd *World) ResetMarbles()
- func (wd *World) Run()
- func (wd *World) Stop()
- func (wd *World) UpdateMarbles()
- type WorldOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultColors = []string{"black", "red", "blue", "green", "purple", "brown", "orange"}
DefaultColors are all of the default colors for marbles and lines
var FunctionNames = []string{"f", "g", "b", "c", "d", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "u", "v", "w", "y", "z"}
FunctionNames has all of the names assigned to functions in order
Functions ¶
func CheckIfChanges ¶
CheckIfChanges checks whether a certain expression will change over time. Returns true if it changes, otherwise false
Types ¶
type Line ¶
type Line struct { *svg.Path FunctionName string Expr mee.Expr GraphIf mee.Expr Bounce mee.Expr Color gist.Color ColorSwitch gist.Color Changes bool }
Line contains the physical line and its data
func (*Line) CheckBlankValues ¶
CheckBlankValues checks if any of the expr strings or other line values are empty, if they are sets them to their defaults
func (*Line) CheckIfChanges ¶
CheckIfChanges checks whether the line will be changed over time
func (*Line) SetFunction ¶
SetFunction sets the function name for a line and adds functions to reference to the function
func (*Line) SetLineParams ¶
SetLineParams sets x, t, a, and h for a line
type TrackingInfo ¶
TrackingInfo contains the tracking info for a single marble
type World ¶
type World struct { *svg.SVG LinesSVG *svg.Group MarblesSVG *svg.Group TrackingSVG *svg.Group AxesSVG *svg.Group Lines Lines Marbles Marbles WorldOptions WorldOptions Functions mee.Functions Time float64 Running bool Error error }
World contains the physical svg and its groups, and the data for the lines and the marbles
func (*World) CompileLines ¶
func (wd *World) CompileLines()
CompileLines compiles all of the expressions in the lines and does other necessary steps needed before graphing
func (*World) Graph ¶
func (wd *World) Graph()
Graph compiles all of the lines, graphs all of the lines of the world and resets the marbles to their starting positions
func (*World) GraphLines ¶
func (wd *World) GraphLines()
GraphLines graphs all of the lines of the world
func (*World) HandleError ¶
HandleError checks if there is an error. If there is it returns true and sets the world error to the error. Otherwise returns false
func (*World) ResetMarbles ¶
func (wd *World) ResetMarbles()
ResetMarbles deletes any existing marbles and makes and graphs new ones
type WorldOptions ¶
type WorldOptions struct { NMarbles int Width float64 StartSpeed float64 MarbleStartPos Vec2 MinSize Vec2 MaxSize Vec2 GraphTimesPerX int }
WorldOptions contains the options for the world
func (*WorldOptions) Defaults ¶
func (wo *WorldOptions) Defaults()
Defaults sets the defaults for the world options