| 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 |
| 35944 | function 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 |