Methods
addNode()
Adds a node and generates random points around it. Creates an event listener for the plot area. If event is left-click,
add node. If event is "escape", cancel.
addSampleSensors()
Add additional sensors to data.
changeColorScale(selected)
Change the edge or face color scale
Parameters:
Name | Type | Description |
---|---|---|
selected |
string | Which color scale to use. |
changeComplex()
Toggle between Vietoris-Rips and Čech complexes.
changeDataRadius(val)
Change the radius of uncertainty and update display. Also update coverage circles and update display.
Parameters:
Name | Type | Description |
---|---|---|
val |
number | The new radius of uncertainty. |
changeNumberSampleSensors()
Allow user to change the number of sensors.
clearScreen()
Clear canvas and reset all variables to their default values.
constructCech()
Construct the Čech complex. For each face determined from the Vietoris-Rips complex, test whether all three points
have a common intersection. Computes a probability for each face.
constructEdges() → {Object}
Compute probability of edge (lines) for all n choose 2 permutations of locations.
Returns:
- Type
- Object
constructRips()
Compute Vietoris-Rips complex. Determine 2-faces (triangles) from location data. Computes a probability for each face.
A face exists for each n choose 3 permutation of points for which each point is pairwise connected by an edge.
createFaceLengend()
Create face legend based on selected color scale.
createRandomPoints(d) → {Array}
Create random points for each data location. Points are uniform random within the radius of uncertainty from anchor.
Parameters:
Name | Type | Description |
---|---|---|
d |
Object | An object with the fields x and y containing the anchor location. |
Returns:
An array of objects with the fields x and y containing the location of each random point.
- Type
- Array
dataLoader(file)
Load formatted JSON data from local file system
Parameters:
Name | Type | Description |
---|---|---|
file |
string | The path to the local file |
dragEnd()
Called after a point is dragged. Updates locations and recomputes simplicial complex.
dragNode()
Drag a node location. Individual points, if displayed, will move along with anchor.
hideToolTip()
Hides object probability.
highlightEdge()
Highlight edge and it's corresponding points.
highlightFace()
Highlight face along with it's corresponding edges and points.
highlightPoint()
Highlights a data point on mouseover or when corresponding edge or face is highlighted.
importData()
Import anchor locations from a CSV file.
Files must contain, at a minimum, a column labeled "xf" and a column labeled "yf" with scalar values corresponding to the anchor coordinates.
Files must contain, at a minimum, a column labeled "xf" and a column labeled "yf" with scalar values corresponding to the anchor coordinates.
loadData()
Allow user to select file from local system and load data.
nodeSelector()
Delete selected nodes, recompute simplicial complexes and re-render or, if escape pressed, unselect points.
perturbData()
Calls the createRandomPoints function on each anchor location in locationData.
randomData()
Generate uniform random anchor locations.
renderAllEdges()
Render individual edges. These are the actual data points for each location that meet the coverage criteria (i.e. have overlapping coverage circles).
renderComplex(edges, faces)
Renders the probabilistic simplicial complexes generated by constructCech() or constructRips
Parameters:
Name | Type | Description |
---|---|---|
edges |
array | An object array containing the edges, must contain the following fields: Pt1, Pt2, Pedge |
faces |
array | An object array containing the faces, must contain the following fields: Pt1, Pt2, Pt3, Pface |
renderEdges()
Renders edges for selected simplicial complex. Colors bundled edges based on probability.
renderFaces()
Renders faces for selected simplicial complex. Colors faces based on probability.
renderGrid()
Render gridlines for every tick mark on axes.
renderPoints()
Render all anchor points, individual points, coverage circles and radius of uncertainty.
renderView()
Render data. Checks the interface for which layers are to be displayed and calls the appropriate rendering functions.
resetCheckboxes()
Resets display checkboxes to their default values.
resetEdge()
Reset edge to default color based on selected color scale.
resetFace()
Reset face to default color based on selected color scale.
resetPoint()
Resets data point to default color as defined by current color scale.
saveData()
Save data to a JSON file.
selectNode()
Select and highlight a node for possible deletion.
setMax()
Allows user to manually set maximum coverage radius.
show(state, type)
Toggle display
Parameters:
Name | Type | Description |
---|---|---|
state |
Boolean | Show if true, hide if false. |
type |
String | Which type of object to display: circle, line, or polygon |
showCoverage(d)
Display or hide coverage circles.
Parameters:
Name | Type | Description |
---|---|---|
d |
Boolean | Show if true, hide if false. |
showToolTip(type, data)
Displays probability of selected edge or face
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Must be 'Edge' or 'Face' |
data |
number | The probability of the object. |
sqEuclidDist(pt1, pt2) → {number}
Calculate squared euclidean distance between 2 data points.
Parameters:
Name | Type | Description |
---|---|---|
pt1 |
Array | 2-element array with coordinates of first data point. |
pt2 |
Array | 2-element array with coordinates of second data point. |
Returns:
- Type
- number
updateComplex(newValue)
Called whenever the data are changed. Updates the coverage radius and recomputes simplicial complexes.
Parameters:
Name | Type | Description |
---|---|---|
newValue |
number | The new coverage radius. |
updateNode(coords)
Update node location after drag and drop. Update anchor location and individual points.
Parameters:
Name | Type | Description |
---|---|---|
coords |
array | 2-element array with new node coordinates. |
updateScales(xMin, xMax, yMin, yMax)
Update the display limits.
Parameters:
Name | Type | Description |
---|---|---|
xMin |
number | The minimum x-value to display. |
xMax |
number | The maximum x-value to display. |
yMin |
number | The minimum y-value to display. |
yMax |
number | The maximum y-value to display. |
zoomed()
Change scales and zoom plot area.