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

Function interp2d

stackgl_modules/index.js:30081–30095  ·  view source on GitHub ↗
(arr, x, y)

Source from the content-addressed store, hash-verified

30079}
30080
30081function interp2d(arr, x, y) {
30082 var ix = Math.floor(x)
30083 , fx = x - ix
30084 , s0 = 0 <= ix && ix < arr.shape[0]
30085 , s1 = 0 <= ix+1 && ix+1 < arr.shape[0]
30086 , iy = Math.floor(y)
30087 , fy = y - iy
30088 , t0 = 0 <= iy && iy < arr.shape[1]
30089 , t1 = 0 <= iy+1 && iy+1 < arr.shape[1]
30090 , w00 = s0&&t0 ? arr.get(ix ,iy ) : 0.0
30091 , w01 = s0&&t1 ? arr.get(ix ,iy+1) : 0.0
30092 , w10 = s1&&t0 ? arr.get(ix+1,iy ) : 0.0
30093 , w11 = s1&&t1 ? arr.get(ix+1,iy+1) : 0.0
30094 return (1.0-fy) * ((1.0-fx)*w00 + fx*w10) + fy * ((1.0-fx)*w01 + fx*w11)
30095}
30096
30097function interp3d(arr, x, y, z) {
30098 var ix = Math.floor(x)

Callers 4

calc.jsFile · 0.85
convert.jsFile · 0.85
heatmappishCalcFunction · 0.85
interpolateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…