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

Function dual

stackgl_modules/index.js:35944–35959  ·  view source on GitHub ↗
(cells, vertex_count)

Source from the content-addressed store, hash-verified

35942
35943//Computes the dual of the mesh. This is basically an optimized version of buildIndex for the situation where from_cells is just the list of vertices
35944function dual(cells, vertex_count) {
35945 if(!vertex_count) {
35946 return incidence(unique(skeleton(cells, 0)), cells, 0)
35947 }
35948 var res = new Array(vertex_count)
35949 for(var i=0; i<vertex_count; ++i) {
35950 res[i] = []
35951 }
35952 for(var i=0, len=cells.length; i<len; ++i) {
35953 var c = cells[i]
35954 for(var j=0, cl=c.length; j<cl; ++j) {
35955 res[c[j]].push(i)
35956 }
35957 }
35958 return res
35959}
35960__webpack_unused_export__ = dual
35961
35962//Enumerates all cells in the complex

Callers

nothing calls this directly

Calls 3

incidenceFunction · 0.85
uniqueFunction · 0.85
skeletonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…