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

Function boxIntersect

stackgl_modules/index.js:6337–6401  ·  view source on GitHub ↗
(red, blue, visit, full)

Source from the content-addressed store, hash-verified

6335
6336//Perform type conversions, check bounds
6337function boxIntersect(red, blue, visit, full) {
6338 var n = red.length
6339 var m = blue.length
6340
6341 //If either array is empty, then we can skip this whole thing
6342 if(n <= 0 || m <= 0) {
6343 return
6344 }
6345
6346 //Compute dimension, if it is 0 then we skip
6347 var d = (red[0].length)>>>1
6348 if(d <= 0) {
6349 return
6350 }
6351
6352 var retval
6353
6354 //Convert red boxes
6355 var redList = pool.mallocDouble(2*d*n)
6356 var redIds = pool.mallocInt32(n)
6357 n = convertBoxes(red, d, redList, redIds)
6358
6359 if(n > 0) {
6360 if(d === 1 && full) {
6361 //Special case: 1d complete
6362 sweep.init(n)
6363 retval = sweep.sweepComplete(
6364 d, visit,
6365 0, n, redList, redIds,
6366 0, n, redList, redIds)
6367 } else {
6368
6369 //Convert blue boxes
6370 var blueList = pool.mallocDouble(2*d*m)
6371 var blueIds = pool.mallocInt32(m)
6372 m = convertBoxes(blue, d, blueList, blueIds)
6373
6374 if(m > 0) {
6375 sweep.init(n+m)
6376
6377 if(d === 1) {
6378 //Special case: 1d bipartite
6379 retval = sweep.sweepBipartite(
6380 d, visit,
6381 0, n, redList, redIds,
6382 0, m, blueList, blueIds)
6383 } else {
6384 //General case: d>1
6385 retval = boxIntersectIter(
6386 d, visit, full,
6387 n, redList, redIds,
6388 m, blueList, blueIds)
6389 }
6390
6391 pool.free(blueList)
6392 pool.free(blueIds)
6393 }
6394 }

Callers 6

intersectFullArrayFunction · 0.85
intersectBipartiteArrayFunction · 0.85
boxIntersectWrapperFunction · 0.85
getCrossingsFunction · 0.85
getTJunctionsFunction · 0.85
dedupPointsFunction · 0.85

Calls 2

convertBoxesFunction · 0.85
boxIntersectIterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…