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

Function incidence

stackgl_modules/index.js:35910–35940  ·  view source on GitHub ↗
(from_cells, to_cells)

Source from the content-addressed store, hash-verified

35908
35909//Builds an index for an n-cell. This is more general than dual, but less efficient
35910function incidence(from_cells, to_cells) {
35911 var index = new Array(from_cells.length)
35912 for(var i=0, il=index.length; i<il; ++i) {
35913 index[i] = []
35914 }
35915 var b = []
35916 for(var i=0, n=to_cells.length; i<n; ++i) {
35917 var c = to_cells[i]
35918 var cl = c.length
35919 for(var k=1, kn=(1<<cl); k<kn; ++k) {
35920 b.length = bits.popCount(k)
35921 var l = 0
35922 for(var j=0; j<cl; ++j) {
35923 if(k & (1<<j)) {
35924 b[l++] = c[j]
35925 }
35926 }
35927 var idx=findCell(from_cells, b)
35928 if(idx < 0) {
35929 continue
35930 }
35931 while(true) {
35932 index[idx++].push(i)
35933 if(idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {
35934 break
35935 }
35936 }
35937 }
35938 }
35939 return index
35940}
35941__webpack_unused_export__ = incidence
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

Callers 1

dualFunction · 0.85

Calls 2

findCellFunction · 0.85
compareCellsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…