MCPcopy Index your code
hub / github.com/plotly/plotly.js / snapRound

Function snapRound

stackgl_modules/index.js:9188–9213  ·  view source on GitHub ↗
(points, edges, useColor)

Source from the content-addressed store, hash-verified

9186
9187// Repeat until convergence
9188function snapRound (points, edges, useColor) {
9189 // 1. find edge crossings
9190 var edgeBounds = boundEdges(points, edges)
9191 var crossings = getCrossings(points, edges, edgeBounds)
9192
9193 // 2. find t-junctions
9194 var vertBounds = boundPoints(points)
9195 var tjunctions = getTJunctions(points, edges, edgeBounds, vertBounds)
9196
9197 // 3. cut edges, construct rational points
9198 var ratPoints = cutEdges(points, edges, crossings, tjunctions, useColor)
9199
9200 // 4. dedupe verts
9201 var labels = dedupPoints(points, ratPoints, vertBounds)
9202
9203 // 5. dedupe edges
9204 dedupEdges(edges, labels, useColor)
9205
9206 // 6. check termination
9207 if (!labels) {
9208 return (crossings.length > 0 || tjunctions.length > 0)
9209 }
9210
9211 // More iterations necessary
9212 return true
9213}
9214
9215// Main loop, runs PSLG clean up until completion
9216function cleanPSLG (points, edges, colors) {

Callers 1

cleanPSLGFunction · 0.85

Calls 7

boundEdgesFunction · 0.85
getCrossingsFunction · 0.85
boundPointsFunction · 0.85
getTJunctionsFunction · 0.85
cutEdgesFunction · 0.85
dedupPointsFunction · 0.85
dedupEdgesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…