Members
lastResetTime :Float
Monitors how often the reset button is pushed. This helps provide debouncing
of the reset button when it is used on mobile devices.
Type:
- Float
nodes :Array.<GraphNodes>
The generated lattice nodes
Type:
- Array.<GraphNodes>
refreshTime :Integer
The number of seconds to wait before auto reset.
Type:
- Integer
refreshTimeDisplay :p5.element
Handler for the paragraphs that displays the current refresh time.
Type:
- p5.element
refreshTimeSlider :p5.element
Handler for the refresh time slider.
Type:
- p5.element
resetButton :p5.element
Handler for the reset button
Type:
- p5.element
spacing :Integer
The pixel spacing between lattice nodes on the canvas.
Type:
- Integer
verticalGridPoints :Integer
The number of lattice nodes on the vertical axis of the grid.
Type:
- Integer
verticalGridPointsDisplay :p5.element
Handler for the paragraphs that displays the current grid size.
Type:
- p5.element
verticalGridPointsSlider :p5.element
Handler for the number of grid points slider.
Type:
- p5.element
walk :Array.<GraphNode>
The generated random self avoiding walk
Type:
- Array.<GraphNode>
Methods
contains(nodesList, nodeIndecies) → {boolean}
Checks to see if a GraphNode list contains a given node.
Parameters:
Name | Type | Description |
---|---|---|
nodesList |
Array.<GraphNode> | The list of nodes |
nodeIndecies |
Array.<Integer> | The lattice indecies. Should not have more than 2 elements representing the components for each lattice vector. |
Returns:
Boolean true if the node is in the list.
- Type
- boolean
draw()
p5.js draw function, is run every frame to create the desired animation
generateTriangleGrid()
Generate a graph of nodes arranged in a triangular pattern
generateWalk()
Generates a random walk given a list of nodes in a grid
getNodeFromList(nodesList, nodeIndecies) → {GraphNode}
Gets the node specified by the lattice indecies from the list.
Parameters:
Name | Type | Description |
---|---|---|
nodesList |
Array.<GraphNode> | The list of nodes |
nodeIndecies |
Array.<Integer> | The lattice indecies. Should not have more than 2 elements representing the components for each lattice vector. |
Returns:
The node from list.
- Type
- GraphNode
reset()
Resets the canvas and draws a new random walk.
setup()
p5.js setup function, creates canvas.