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

Function interp3d

stackgl_modules/index.js:30097–30119  ·  view source on GitHub ↗
(arr, x, y, z)

Source from the content-addressed store, hash-verified

30095}
30096
30097function interp3d(arr, x, y, z) {
30098 var ix = Math.floor(x)
30099 , fx = x - ix
30100 , s0 = 0 <= ix && ix < arr.shape[0]
30101 , s1 = 0 <= ix+1 && ix+1 < arr.shape[0]
30102 , iy = Math.floor(y)
30103 , fy = y - iy
30104 , t0 = 0 <= iy && iy < arr.shape[1]
30105 , t1 = 0 <= iy+1 && iy+1 < arr.shape[1]
30106 , iz = Math.floor(z)
30107 , fz = z - iz
30108 , u0 = 0 <= iz && iz < arr.shape[2]
30109 , u1 = 0 <= iz+1 && iz+1 < arr.shape[2]
30110 , w000 = s0&&t0&&u0 ? arr.get(ix,iy,iz) : 0.0
30111 , w010 = s0&&t1&&u0 ? arr.get(ix,iy+1,iz) : 0.0
30112 , w100 = s1&&t0&&u0 ? arr.get(ix+1,iy,iz) : 0.0
30113 , w110 = s1&&t1&&u0 ? arr.get(ix+1,iy+1,iz) : 0.0
30114 , w001 = s0&&t0&&u1 ? arr.get(ix,iy,iz+1) : 0.0
30115 , w011 = s0&&t1&&u1 ? arr.get(ix,iy+1,iz+1) : 0.0
30116 , w101 = s1&&t0&&u1 ? arr.get(ix+1,iy,iz+1) : 0.0
30117 , w111 = s1&&t1&&u1 ? arr.get(ix+1,iy+1,iz+1) : 0.0
30118 return (1.0-fz) * ((1.0-fy) * ((1.0-fx)*w000 + fx*w100) + fy * ((1.0-fx)*w010 + fx*w110)) + fz * ((1.0-fy) * ((1.0-fx)*w001 + fx*w101) + fy * ((1.0-fx)*w011 + fx*w111))
30119}
30120
30121function interpNd(arr) {
30122 var d = arr.shape.length|0

Callers 1

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…