UNPKG

plotly.js

Version:

The open source javascript graphing library that powers plotly

1,582 lines (1,327 loc) 1.1 MB
/******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 24: /***/ (function(module) { var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset function mouseEventOffset (ev, target, out) { target = target || ev.currentTarget || ev.srcElement if (!Array.isArray(out)) { out = [ 0, 0 ] } var cx = ev.clientX || 0 var cy = ev.clientY || 0 var rect = getBoundingClientOffset(target) out[0] = cx - rect.left out[1] = cy - rect.top return out } function getBoundingClientOffset (element) { if (element === window || element === document || element === document.body) { return rootPosition } else { return element.getBoundingClientRect() } } /***/ }), /***/ 109: /***/ (function(module) { module.exports = rotateY; /** * Rotate a 3D vector around the y-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ function rotateY(out, a, b, c){ var bx = b[0] var bz = b[2] // translate point to the origin var px = a[0] - bx var pz = a[2] - bz var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = bx + pz * sc + px * cc out[1] = a[1] out[2] = bz + pz * cc - px * sc return out } /***/ }), /***/ 160: /***/ (function(module) { module.exports = max /** * Returns the maximum of two vec4's * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {vec4} out */ function max (out, a, b) { out[0] = Math.max(a[0], b[0]) out[1] = Math.max(a[1], b[1]) out[2] = Math.max(a[2], b[2]) out[3] = Math.max(a[3], b[3]) return out } /***/ }), /***/ 216: /***/ (function(module) { "use strict"; module.exports = makeReflectTypes //Construct type info for reflection. // // This iterates over the flattened list of uniform type values and smashes them into a JSON object. // // The leaves of the resulting object are either indices or type strings representing primitive glslify types function makeReflectTypes(uniforms, useIndex) { var obj = {} for(var i=0; i<uniforms.length; ++i) { var n = uniforms[i].name var parts = n.split(".") var o = obj for(var j=0; j<parts.length; ++j) { var x = parts[j].split("[") if(x.length > 1) { if(!(x[0] in o)) { o[x[0]] = [] } o = o[x[0]] for(var k=1; k<x.length; ++k) { var y = parseInt(x[k]) if(k<x.length-1 || j<parts.length-1) { if(!(y in o)) { if(k < x.length-1) { o[y] = [] } else { o[y] = {} } } o = o[y] } else { if(useIndex) { o[y] = i } else { o[y] = uniforms[i].type } } } } else if(j < parts.length-1) { if(!(x[0] in o)) { o[x[0]] = {} } o = o[x[0]] } else { if(useIndex) { o[x[0]] = i } else { o[x[0]] = uniforms[i].type } } } } return obj } /***/ }), /***/ 236: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var hiddenStore = __webpack_require__(8284); module.exports = createStore; function createStore() { var key = {}; return function (obj) { if ((typeof obj !== 'object' || obj === null) && typeof obj !== 'function' ) { throw new Error('Weakmap-shim: Key must be object') } var store = obj.valueOf(key); return store && store.identity === key ? store : hiddenStore(obj, key); }; } /***/ }), /***/ 244: /***/ (function(module) { module.exports = dot; /** * Calculates the dot product of two vec3's * * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } /***/ }), /***/ 264: /***/ (function(module) { module.exports = transformQuat; /** * Transforms the vec3 with a quat * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {quat} q quaternion to transform with * @returns {vec3} out */ function transformQuat(out, a, q) { // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations var x = a[0], y = a[1], z = a[2], qx = q[0], qy = q[1], qz = q[2], qw = q[3], // calculate quat * vec ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z // calculate result * inverse quat out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx return out } /***/ }), /***/ 332: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; module.exports = cleanPSLG var UnionFind = __webpack_require__(1755) var boxIntersect = __webpack_require__(6867) var segseg = __webpack_require__(1125) var rat = __webpack_require__(7842) var ratCmp = __webpack_require__(1318) var ratToFloat = __webpack_require__(946) var ratVec = __webpack_require__(5838) var nextafter = __webpack_require__(1278) var solveIntersection = __webpack_require__(3637) // Bounds on a rational number when rounded to a float function boundRat (r) { var f = ratToFloat(r) return [ nextafter(f, -Infinity), nextafter(f, Infinity) ] } // Convert a list of edges in a pslg to bounding boxes function boundEdges (points, edges) { var bounds = new Array(edges.length) for (var i = 0; i < edges.length; ++i) { var e = edges[i] var a = points[e[0]] var b = points[e[1]] bounds[i] = [ nextafter(Math.min(a[0], b[0]), -Infinity), nextafter(Math.min(a[1], b[1]), -Infinity), nextafter(Math.max(a[0], b[0]), Infinity), nextafter(Math.max(a[1], b[1]), Infinity) ] } return bounds } // Convert a list of points into bounding boxes by duplicating coords function boundPoints (points) { var bounds = new Array(points.length) for (var i = 0; i < points.length; ++i) { var p = points[i] bounds[i] = [ nextafter(p[0], -Infinity), nextafter(p[1], -Infinity), nextafter(p[0], Infinity), nextafter(p[1], Infinity) ] } return bounds } // Find all pairs of crossing edges in a pslg (given edge bounds) function getCrossings (points, edges, edgeBounds) { var result = [] boxIntersect(edgeBounds, function (i, j) { var e = edges[i] var f = edges[j] if (e[0] === f[0] || e[0] === f[1] || e[1] === f[0] || e[1] === f[1]) { return } var a = points[e[0]] var b = points[e[1]] var c = points[f[0]] var d = points[f[1]] if (segseg(a, b, c, d)) { result.push([i, j]) } }) return result } // Find all pairs of crossing vertices in a pslg (given edge/vert bounds) function getTJunctions (points, edges, edgeBounds, vertBounds) { var result = [] boxIntersect(edgeBounds, vertBounds, function (i, v) { var e = edges[i] if (e[0] === v || e[1] === v) { return } var p = points[v] var a = points[e[0]] var b = points[e[1]] if (segseg(a, b, p, p)) { result.push([i, v]) } }) return result } // Cut edges along crossings/tjunctions function cutEdges (floatPoints, edges, crossings, junctions, useColor) { var i, e // Convert crossings into tjunctions by constructing rational points var ratPoints = floatPoints.map(function(p) { return [ rat(p[0]), rat(p[1]) ] }) for (i = 0; i < crossings.length; ++i) { var crossing = crossings[i] e = crossing[0] var f = crossing[1] var ee = edges[e] var ef = edges[f] var x = solveIntersection( ratVec(floatPoints[ee[0]]), ratVec(floatPoints[ee[1]]), ratVec(floatPoints[ef[0]]), ratVec(floatPoints[ef[1]])) if (!x) { // Segments are parallel, should already be handled by t-junctions continue } var idx = floatPoints.length floatPoints.push([ratToFloat(x[0]), ratToFloat(x[1])]) ratPoints.push(x) junctions.push([e, idx], [f, idx]) } // Sort tjunctions junctions.sort(function (a, b) { if (a[0] !== b[0]) { return a[0] - b[0] } var u = ratPoints[a[1]] var v = ratPoints[b[1]] return ratCmp(u[0], v[0]) || ratCmp(u[1], v[1]) }) // Split edges along junctions for (i = junctions.length - 1; i >= 0; --i) { var junction = junctions[i] e = junction[0] var edge = edges[e] var s = edge[0] var t = edge[1] // Check if edge is not lexicographically sorted var a = floatPoints[s] var b = floatPoints[t] if (((a[0] - b[0]) || (a[1] - b[1])) < 0) { var tmp = s s = t t = tmp } // Split leading edge edge[0] = s var last = edge[1] = junction[1] // If we are grouping edges by color, remember to track data var color if (useColor) { color = edge[2] } // Split other edges while (i > 0 && junctions[i - 1][0] === e) { var junction = junctions[--i] var next = junction[1] if (useColor) { edges.push([last, next, color]) } else { edges.push([last, next]) } last = next } // Add final edge if (useColor) { edges.push([last, t, color]) } else { edges.push([last, t]) } } // Return constructed rational points return ratPoints } // Merge overlapping points function dedupPoints (floatPoints, ratPoints, floatBounds) { var numPoints = ratPoints.length var uf = new UnionFind(numPoints) // Compute rational bounds var bounds = [] for (var i = 0; i < ratPoints.length; ++i) { var p = ratPoints[i] var xb = boundRat(p[0]) var yb = boundRat(p[1]) bounds.push([ nextafter(xb[0], -Infinity), nextafter(yb[0], -Infinity), nextafter(xb[1], Infinity), nextafter(yb[1], Infinity) ]) } // Link all points with over lapping boxes boxIntersect(bounds, function (i, j) { uf.link(i, j) }) // Do 1 pass over points to combine points in label sets var noDupes = true var labels = new Array(numPoints) for (var i = 0; i < numPoints; ++i) { var j = uf.find(i) if (j !== i) { // Clear no-dupes flag, zero out label noDupes = false // Make each point the top-left point from its cell floatPoints[j] = [ Math.min(floatPoints[i][0], floatPoints[j][0]), Math.min(floatPoints[i][1], floatPoints[j][1]) ] } } // If no duplicates, return null to signal termination if (noDupes) { return null } var ptr = 0 for (var i = 0; i < numPoints; ++i) { var j = uf.find(i) if (j === i) { labels[i] = ptr floatPoints[ptr++] = floatPoints[i] } else { labels[i] = -1 } } floatPoints.length = ptr // Do a second pass to fix up missing labels for (var i = 0; i < numPoints; ++i) { if (labels[i] < 0) { labels[i] = labels[uf.find(i)] } } // Return resulting union-find data structure return labels } function compareLex2 (a, b) { return (a[0] - b[0]) || (a[1] - b[1]) } function compareLex3 (a, b) { var d = (a[0] - b[0]) || (a[1] - b[1]) if (d) { return d } if (a[2] < b[2]) { return -1 } else if (a[2] > b[2]) { return 1 } return 0 } // Remove duplicate edge labels function dedupEdges (edges, labels, useColor) { if (edges.length === 0) { return } if (labels) { for (var i = 0; i < edges.length; ++i) { var e = edges[i] var a = labels[e[0]] var b = labels[e[1]] e[0] = Math.min(a, b) e[1] = Math.max(a, b) } } else { for (var i = 0; i < edges.length; ++i) { var e = edges[i] var a = e[0] var b = e[1] e[0] = Math.min(a, b) e[1] = Math.max(a, b) } } if (useColor) { edges.sort(compareLex3) } else { edges.sort(compareLex2) } var ptr = 1 for (var i = 1; i < edges.length; ++i) { var prev = edges[i - 1] var next = edges[i] if (next[0] === prev[0] && next[1] === prev[1] && (!useColor || next[2] === prev[2])) { continue } edges[ptr++] = next } edges.length = ptr } function preRound (points, edges, useColor) { var labels = dedupPoints(points, [], boundPoints(points)) dedupEdges(edges, labels, useColor) return !!labels } // Repeat until convergence function snapRound (points, edges, useColor) { // 1. find edge crossings var edgeBounds = boundEdges(points, edges) var crossings = getCrossings(points, edges, edgeBounds) // 2. find t-junctions var vertBounds = boundPoints(points) var tjunctions = getTJunctions(points, edges, edgeBounds, vertBounds) // 3. cut edges, construct rational points var ratPoints = cutEdges(points, edges, crossings, tjunctions, useColor) // 4. dedupe verts var labels = dedupPoints(points, ratPoints, vertBounds) // 5. dedupe edges dedupEdges(edges, labels, useColor) // 6. check termination if (!labels) { return (crossings.length > 0 || tjunctions.length > 0) } // More iterations necessary return true } // Main loop, runs PSLG clean up until completion function cleanPSLG (points, edges, colors) { // If using colors, augment edges with color data var prevEdges if (colors) { prevEdges = edges var augEdges = new Array(edges.length) for (var i = 0; i < edges.length; ++i) { var e = edges[i] augEdges[i] = [e[0], e[1], colors[i]] } edges = augEdges } // First round: remove duplicate edges and points var modified = preRound(points, edges, !!colors) // Run snap rounding until convergence while (snapRound(points, edges, !!colors)) { modified = true } // Strip color tags if (!!colors && modified) { prevEdges.length = 0 colors.length = 0 for (var i = 0; i < edges.length; ++i) { var e = edges[i] prevEdges.push([e[0], e[1]]) colors.push(e[2]) } } return modified } /***/ }), /***/ 351: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; module.exports = mouseListen var mouse = __webpack_require__(4687) function mouseListen (element, callback) { if (!callback) { callback = element element = window } var buttonState = 0 var x = 0 var y = 0 var mods = { shift: false, alt: false, control: false, meta: false } var attached = false function updateMods (ev) { var changed = false if ('altKey' in ev) { changed = changed || ev.altKey !== mods.alt mods.alt = !!ev.altKey } if ('shiftKey' in ev) { changed = changed || ev.shiftKey !== mods.shift mods.shift = !!ev.shiftKey } if ('ctrlKey' in ev) { changed = changed || ev.ctrlKey !== mods.control mods.control = !!ev.ctrlKey } if ('metaKey' in ev) { changed = changed || ev.metaKey !== mods.meta mods.meta = !!ev.metaKey } return changed } function handleEvent (nextButtons, ev) { var nextX = mouse.x(ev) var nextY = mouse.y(ev) if ('buttons' in ev) { nextButtons = ev.buttons | 0 } if (nextButtons !== buttonState || nextX !== x || nextY !== y || updateMods(ev)) { buttonState = nextButtons | 0 x = nextX || 0 y = nextY || 0 callback && callback(buttonState, x, y, mods) } } function clearState (ev) { handleEvent(0, ev) } function handleBlur () { if (buttonState || x || y || mods.shift || mods.alt || mods.meta || mods.control) { x = y = 0 buttonState = 0 mods.shift = mods.alt = mods.control = mods.meta = false callback && callback(0, 0, 0, mods) } } function handleMods (ev) { if (updateMods(ev)) { callback && callback(buttonState, x, y, mods) } } function handleMouseMove (ev) { if (mouse.buttons(ev) === 0) { handleEvent(0, ev) } else { handleEvent(buttonState, ev) } } function handleMouseDown (ev) { handleEvent(buttonState | mouse.buttons(ev), ev) } function handleMouseUp (ev) { handleEvent(buttonState & ~mouse.buttons(ev), ev) } function attachListeners () { if (attached) { return } attached = true element.addEventListener('mousemove', handleMouseMove) element.addEventListener('mousedown', handleMouseDown) element.addEventListener('mouseup', handleMouseUp) element.addEventListener('mouseleave', clearState) element.addEventListener('mouseenter', clearState) element.addEventListener('mouseout', clearState) element.addEventListener('mouseover', clearState) element.addEventListener('blur', handleBlur) element.addEventListener('keyup', handleMods) element.addEventListener('keydown', handleMods) element.addEventListener('keypress', handleMods) if (element !== window) { window.addEventListener('blur', handleBlur) window.addEventListener('keyup', handleMods) window.addEventListener('keydown', handleMods) window.addEventListener('keypress', handleMods) } } function detachListeners () { if (!attached) { return } attached = false element.removeEventListener('mousemove', handleMouseMove) element.removeEventListener('mousedown', handleMouseDown) element.removeEventListener('mouseup', handleMouseUp) element.removeEventListener('mouseleave', clearState) element.removeEventListener('mouseenter', clearState) element.removeEventListener('mouseout', clearState) element.removeEventListener('mouseover', clearState) element.removeEventListener('blur', handleBlur) element.removeEventListener('keyup', handleMods) element.removeEventListener('keydown', handleMods) element.removeEventListener('keypress', handleMods) if (element !== window) { window.removeEventListener('blur', handleBlur) window.removeEventListener('keyup', handleMods) window.removeEventListener('keydown', handleMods) window.removeEventListener('keypress', handleMods) } } // Attach listeners attachListeners() var result = { element: element } Object.defineProperties(result, { enabled: { get: function () { return attached }, set: function (f) { if (f) { attachListeners() } else { detachListeners() } }, enumerable: true }, buttons: { get: function () { return buttonState }, enumerable: true }, x: { get: function () { return x }, enumerable: true }, y: { get: function () { return y }, enumerable: true }, mods: { get: function () { return mods }, enumerable: true } }) return result } /***/ }), /***/ 395: /***/ (function(module) { function lerp(v0, v1, t) { return v0*(1-t)+v1*t } module.exports = lerp /***/ }), /***/ 446: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var compile = __webpack_require__(7640) var CACHE = {} function sort(array) { var order = array.order var dtype = array.dtype var typeSig = [order, dtype ] var typeName = typeSig.join(":") var compiled = CACHE[typeName] if(!compiled) { CACHE[typeName] = compiled = compile(order, dtype) } compiled(array) return array } module.exports = sort /***/ }), /***/ 483: /***/ (function(module) { module.exports = squaredLength /** * Calculates the squared length of a vec4 * * @param {vec4} a vector to calculate squared length of * @returns {Number} squared length of a */ function squaredLength (a) { var x = a[0], y = a[1], z = a[2], w = a[3] return x * x + y * y + z * z + w * w } /***/ }), /***/ 492: /***/ (function(module) { module.exports = transformMat3; /** * Transforms the vec3 with a mat3. * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {mat4} m the 3x3 matrix to transform with * @returns {vec3} out */ function transformMat3(out, a, m) { var x = a[0], y = a[1], z = a[2] out[0] = x * m[0] + y * m[3] + z * m[6] out[1] = x * m[1] + y * m[4] + z * m[7] out[2] = x * m[2] + y * m[5] + z * m[8] return out } /***/ }), /***/ 501: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; module.exports = createLines var createBuffer = __webpack_require__(2762) var createVAO = __webpack_require__(8116) var createShader = (__webpack_require__(1879)/* .line */ .n) var MAJOR_AXIS = [0,0,0] var MINOR_AXIS = [0,0,0] var SCREEN_AXIS = [0,0,0] var OFFSET_VEC = [0,0,0] var SHAPE = [1,1] function zeroVec(a) { a[0] = a[1] = a[2] = 0 return a } function copyVec(a,b) { a[0] = b[0] a[1] = b[1] a[2] = b[2] return a } function Lines(gl, vertBuffer, vao, shader, tickCount, tickOffset, gridCount, gridOffset) { this.gl = gl this.vertBuffer = vertBuffer this.vao = vao this.shader = shader this.tickCount = tickCount this.tickOffset = tickOffset this.gridCount = gridCount this.gridOffset = gridOffset } var proto = Lines.prototype proto.bind = function(model, view, projection) { this.shader.bind() this.shader.uniforms.model = model this.shader.uniforms.view = view this.shader.uniforms.projection = projection SHAPE[0] = this.gl.drawingBufferWidth SHAPE[1] = this.gl.drawingBufferHeight this.shader.uniforms.screenShape = SHAPE this.vao.bind() } proto.unbind = function() { this.vao.unbind() } proto.drawAxisLine = function(j, bounds, offset, color, lineWidth) { var minorAxis = zeroVec(MINOR_AXIS) this.shader.uniforms.majorAxis = MINOR_AXIS minorAxis[j] = bounds[1][j] - bounds[0][j] this.shader.uniforms.minorAxis = minorAxis var noffset = copyVec(OFFSET_VEC, offset) noffset[j] += bounds[0][j] this.shader.uniforms.offset = noffset this.shader.uniforms.lineWidth = lineWidth this.shader.uniforms.color = color var screenAxis = zeroVec(SCREEN_AXIS) screenAxis[(j+2)%3] = 1 this.shader.uniforms.screenAxis = screenAxis this.vao.draw(this.gl.TRIANGLES, 6) var screenAxis = zeroVec(SCREEN_AXIS) screenAxis[(j+1)%3] = 1 this.shader.uniforms.screenAxis = screenAxis this.vao.draw(this.gl.TRIANGLES, 6) } proto.drawAxisTicks = function(j, offset, minorAxis, color, lineWidth) { if(!this.tickCount[j]) { return } var majorAxis = zeroVec(MAJOR_AXIS) majorAxis[j] = 1 this.shader.uniforms.majorAxis = majorAxis this.shader.uniforms.offset = offset this.shader.uniforms.minorAxis = minorAxis this.shader.uniforms.color = color this.shader.uniforms.lineWidth = lineWidth var screenAxis = zeroVec(SCREEN_AXIS) screenAxis[j] = 1 this.shader.uniforms.screenAxis = screenAxis this.vao.draw(this.gl.TRIANGLES, this.tickCount[j], this.tickOffset[j]) } proto.drawGrid = function(i, j, bounds, offset, color, lineWidth) { if(!this.gridCount[i]) { return } var minorAxis = zeroVec(MINOR_AXIS) minorAxis[j] = bounds[1][j] - bounds[0][j] this.shader.uniforms.minorAxis = minorAxis var noffset = copyVec(OFFSET_VEC, offset) noffset[j] += bounds[0][j] this.shader.uniforms.offset = noffset var majorAxis = zeroVec(MAJOR_AXIS) majorAxis[i] = 1 this.shader.uniforms.majorAxis = majorAxis var screenAxis = zeroVec(SCREEN_AXIS) screenAxis[i] = 1 this.shader.uniforms.screenAxis = screenAxis this.shader.uniforms.lineWidth = lineWidth this.shader.uniforms.color = color this.vao.draw(this.gl.TRIANGLES, this.gridCount[i], this.gridOffset[i]) } proto.drawZero = function(j, i, bounds, offset, color, lineWidth) { var minorAxis = zeroVec(MINOR_AXIS) this.shader.uniforms.majorAxis = minorAxis minorAxis[j] = bounds[1][j] - bounds[0][j] this.shader.uniforms.minorAxis = minorAxis var noffset = copyVec(OFFSET_VEC, offset) noffset[j] += bounds[0][j] this.shader.uniforms.offset = noffset var screenAxis = zeroVec(SCREEN_AXIS) screenAxis[i] = 1 this.shader.uniforms.screenAxis = screenAxis this.shader.uniforms.lineWidth = lineWidth this.shader.uniforms.color = color this.vao.draw(this.gl.TRIANGLES, 6) } proto.dispose = function() { this.vao.dispose() this.vertBuffer.dispose() this.shader.dispose() } function createLines(gl, bounds, ticks) { var vertices = [] var tickOffset = [0,0,0] var tickCount = [0,0,0] //Create grid lines for each axis/direction var gridOffset = [0,0,0] var gridCount = [0,0,0] //Add zero line vertices.push( 0,0,1, 0,1,1, 0,0,-1, 0,0,-1, 0,1,1, 0,1,-1) for(var i=0; i<3; ++i) { //Axis tick marks var start = ((vertices.length / 3)|0) for(var j=0; j<ticks[i].length; ++j) { var x = +ticks[i][j].x vertices.push( x,0,1, x,1,1, x,0,-1, x,0,-1, x,1,1, x,1,-1) } var end = ((vertices.length / 3)|0) tickOffset[i] = start tickCount[i] = end - start //Grid lines var start = ((vertices.length / 3)|0) for(var k=0; k<ticks[i].length; ++k) { var x = +ticks[i][k].x vertices.push( x,0,1, x,1,1, x,0,-1, x,0,-1, x,1,1, x,1,-1) } var end = ((vertices.length / 3)|0) gridOffset[i] = start gridCount[i] = end - start } //Create cube VAO var vertBuf = createBuffer(gl, new Float32Array(vertices)) var vao = createVAO(gl, [ { "buffer": vertBuf, "type": gl.FLOAT, "size": 3, "stride": 0, "offset": 0 } ]) var shader = createShader(gl) shader.attributes.position.location = 0 return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } /***/ }), /***/ 544: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var bnsub = __webpack_require__(5572) module.exports = sub function sub(a, b) { var n = a.length var r = new Array(n) for(var i=0; i<n; ++i) { r[i] = bnsub(a[i], b[i]) } return r } /***/ }), /***/ 606: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). var createStore = __webpack_require__(236); module.exports = weakMap; function weakMap() { var privates = createStore(); return { 'get': function (key, fallback) { var store = privates(key) return store.hasOwnProperty('value') ? store.value : fallback }, 'set': function (key, value) { privates(key).value = value; return this; }, 'has': function(key) { return 'value' in privates(key); }, 'delete': function (key) { return delete privates(key).value; } } } /***/ }), /***/ 614: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var glslify = __webpack_require__(3236) var triVertSrc = glslify(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * conePosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n\n f_color = color;\n f_data = conePosition.xyz;\n f_position = position.xyz;\n f_uv = uv;\n}\n"]) var triFragSrc = glslify(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]) var pickVertSrc = glslify(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n gl_Position = projection * (view * conePosition);\n f_id = id;\n f_position = position.xyz;\n}\n"]) var pickFragSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]) exports.meshShader = { vertex: triVertSrc, fragment: triFragSrc, attributes: [ {name: 'position', type: 'vec4'}, {name: 'color', type: 'vec4'}, {name: 'uv', type: 'vec2'}, {name: 'vector', type: 'vec3'} ] } exports.pickShader = { vertex: pickVertSrc, fragment: pickFragSrc, attributes: [ {name: 'position', type: 'vec4'}, {name: 'id', type: 'vec4'}, {name: 'vector', type: 'vec3'} ] } /***/ }), /***/ 620: /***/ (function(module) { module.exports = [ // current 'precision' , 'highp' , 'mediump' , 'lowp' , 'attribute' , 'const' , 'uniform' , 'varying' , 'break' , 'continue' , 'do' , 'for' , 'while' , 'if' , 'else' , 'in' , 'out' , 'inout' , 'float' , 'int' , 'uint' , 'void' , 'bool' , 'true' , 'false' , 'discard' , 'return' , 'mat2' , 'mat3' , 'mat4' , 'vec2' , 'vec3' , 'vec4' , 'ivec2' , 'ivec3' , 'ivec4' , 'bvec2' , 'bvec3' , 'bvec4' , 'sampler1D' , 'sampler2D' , 'sampler3D' , 'samplerCube' , 'sampler1DShadow' , 'sampler2DShadow' , 'struct' // future , 'asm' , 'class' , 'union' , 'enum' , 'typedef' , 'template' , 'this' , 'packed' , 'goto' , 'switch' , 'default' , 'inline' , 'noinline' , 'volatile' , 'public' , 'static' , 'extern' , 'external' , 'interface' , 'long' , 'short' , 'double' , 'half' , 'fixed' , 'unsigned' , 'input' , 'output' , 'hvec2' , 'hvec3' , 'hvec4' , 'dvec2' , 'dvec3' , 'dvec4' , 'fvec2' , 'fvec3' , 'fvec4' , 'sampler2DRect' , 'sampler3DRect' , 'sampler2DRectShadow' , 'sizeof' , 'cast' , 'namespace' , 'using' ] /***/ }), /***/ 665: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parseUnit = __webpack_require__(3202) module.exports = toPX var PIXELS_PER_INCH = 96 function getPropertyInPX(element, prop) { var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop)) return parts[0] * toPX(parts[1], element) } //This brutal hack is needed function getSizeBrutal(unit, element) { var testDIV = document.createElement('div') testDIV.style['font-size'] = '128' + unit element.appendChild(testDIV) var size = getPropertyInPX(testDIV, 'font-size') / 128 element.removeChild(testDIV) return size } function toPX(str, element) { element = element || document.body str = (str || 'px').trim().toLowerCase() if(element === window || element === document) { element = document.body } switch(str) { case '%': //Ambiguous, not sure if we should use width or height return element.clientHeight / 100.0 case 'ch': case 'ex': return getSizeBrutal(str, element) case 'em': return getPropertyInPX(element, 'font-size') case 'rem': return getPropertyInPX(document.body, 'font-size') case 'vw': return window.innerWidth/100 case 'vh': return window.innerHeight/100 case 'vmin': return Math.min(window.innerWidth, window.innerHeight) / 100 case 'vmax': return Math.max(window.innerWidth, window.innerHeight) / 100 case 'in': return PIXELS_PER_INCH case 'cm': return PIXELS_PER_INCH / 2.54 case 'mm': return PIXELS_PER_INCH / 25.4 case 'pt': return PIXELS_PER_INCH / 72 case 'pc': return PIXELS_PER_INCH / 6 } return 1 } /***/ }), /***/ 727: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var determinant = __webpack_require__(2962) var NUM_EXPAND = 6 function generateSolver(n) { var fn = n === 2 ? solve2d : n === 3 ? solve3d : n === 4 ? solve4d : n === 5 ? solve5d : solve6d if(n < 6) { return fn(determinant[n]) } return fn(determinant) } function robustLinearSolve0d() { return [ [ 0 ] ] } function robustLinearSolve1d(A, b) { return [ [ b[0] ], [ A[0][0] ] ] } function solve2d(det) { return function robustLinearSolve2d(A, b) { return [det([[+b[0], +A[0][1]], [+b[1], +A[1][1]]]), det([[+A[0][0], +b[0]], [+A[1][0], +b[1]]]), det(A)] } } function solve3d(det) { return function robustLinearSolve3d(A, b) { return [det([[+b[0], +A[0][1], +A[0][2]], [+b[1], +A[1][1], +A[1][2]], [+b[2], +A[2][1], +A[2][2]]]), det([[+A[0][0], +b[0], +A[0][2]], [+A[1][0], +b[1], +A[1][2]], [+A[2][0], +b[2], +A[2][2]]]), det([[+A[0][0], +A[0][1], +b[0]], [+A[1][0], +A[1][1], +b[1]], [+A[2][0], +A[2][1], +b[2]]]), det(A)] } } function solve4d(det) { return function robustLinearSolve4d(A, b) { return [det([[+b[0], +A[0][1], +A[0][2], +A[0][3]], [+b[1], +A[1][1], +A[1][2], +A[1][3]], [+b[2], +A[2][1], +A[2][2], +A[2][3]], [+b[3], +A[3][1], +A[3][2], +A[3][3]]]), det([[+A[0][0], +b[0], +A[0][2], +A[0][3]], [+A[1][0], +b[1], +A[1][2], +A[1][3]], [+A[2][0], +b[2], +A[2][2], +A[2][3]], [+A[3][0], +b[3], +A[3][2], +A[3][3]]]), det([[+A[0][0], +A[0][1], +b[0], +A[0][3]], [+A[1][0], +A[1][1], +b[1], +A[1][3]], [+A[2][0], +A[2][1], +b[2], +A[2][3]], [+A[3][0], +A[3][1], +b[3], +A[3][3]]]), det([[+A[0][0], +A[0][1], +A[0][2], +b[0]], [+A[1][0], +A[1][1], +A[1][2], +b[1]], [+A[2][0], +A[2][1], +A[2][2], +b[2]], [+A[3][0], +A[3][1], +A[3][2], +b[3]]]), det(A)] } } function solve5d(det) { return function robustLinearSolve5d(A, b) { return [det([[+b[0], +A[0][1], +A[0][2], +A[0][3], +A[0][4]], [+b[1], +A[1][1], +A[1][2], +A[1][3], +A[1][4]], [+b[2], +A[2][1], +A[2][2], +A[2][3], +A[2][4]], [+b[3], +A[3][1], +A[3][2], +A[3][3], +A[3][4]], [+b[4], +A[4][1], +A[4][2], +A[4][3], +A[4][4]]]), det([[+A[0][0], +b[0], +A[0][2], +A[0][3], +A[0][4]], [+A[1][0], +b[1], +A[1][2], +A[1][3], +A[1][4]], [+A[2][0], +b[2], +A[2][2], +A[2][3], +A[2][4]], [+A[3][0], +b[3], +A[3][2], +A[3][3], +A[3][4]], [+A[4][0], +b[4], +A[4][2], +A[4][3], +A[4][4]]]), det([[+A[0][0], +A[0][1], +b[0], +A[0][3], +A[0][4]], [+A[1][0], +A[1][1], +b[1], +A[1][3], +A[1][4]], [+A[2][0], +A[2][1], +b[2], +A[2][3], +A[2][4]], [+A[3][0], +A[3][1], +b[3], +A[3][3], +A[3][4]], [+A[4][0], +A[4][1], +b[4], +A[4][3], +A[4][4]]]), det([[+A[0][0], +A[0][1], +A[0][2], +b[0], +A[0][4]], [+A[1][0], +A[1][1], +A[1][2], +b[1], +A[1][4]], [+A[2][0], +A[2][1], +A[2][2], +b[2], +A[2][4]], [+A[3][0], +A[3][1], +A[3][2], +b[3], +A[3][4]], [+A[4][0], +A[4][1], +A[4][2], +b[4], +A[4][4]]]), det([[+A[0][0], +A[0][1], +A[0][2], +A[0][3], +b[0]], [+A[1][0], +A[1][1], +A[1][2], +A[1][3], +b[1]], [+A[2][0], +A[2][1], +A[2][2], +A[2][3], +b[2]], [+A[3][0], +A[3][1], +A[3][2], +A[3][3], +b[3]], [+A[4][0], +A[4][1], +A[4][2], +A[4][3], +b[4]]]), det(A)] } } function solve6d(det) { return function robustLinearSolve6d(A, b) { return [det([[+b[0], +A[0][1], +A[0][2], +A[0][3], +A[0][4], +A[0][5]], [+b[1], +A[1][1], +A[1][2], +A[1][3], +A[1][4], +A[1][5]], [+b[2], +A[2][1], +A[2][2], +A[2][3], +A[2][4], +A[2][5]], [+b[3], +A[3][1], +A[3][2], +A[3][3], +A[3][4], +A[3][5]], [+b[4], +A[4][1], +A[4][2], +A[4][3], +A[4][4], +A[4][5]], [+b[5], +A[5][1], +A[5][2], +A[5][3], +A[5][4], +A[5][5]]]), det([[+A[0][0], +b[0], +A[0][2], +A[0][3], +A[0][4], +A[0][5]], [+A[1][0], +b[1], +A[1][2], +A[1][3], +A[1][4], +A[1][5]], [+A[2][0], +b[2], +A[2][2], +A[2][3], +A[2][4], +A[2][5]], [+A[3][0], +b[3], +A[3][2], +A[3][3], +A[3][4], +A[3][5]], [+A[4][0], +b[4], +A[4][2], +A[4][3], +A[4][4], +A[4][5]], [+A[5][0], +b[5], +A[5][2], +A[5][3], +A[5][4], +A[5][5]]]), det([[+A[0][0], +A[0][1], +b[0], +A[0][3], +A[0][4], +A[0][5]], [+A[1][0], +A[1][1], +b[1], +A[1][3], +A[1][4], +A[1][5]], [+A[2][0], +A[2][1], +b[2], +A[2][3], +A[2][4], +A[2][5]], [+A[3][0], +A[3][1], +b[3], +A[3][3], +A[3][4], +A[3][5]], [+A[4][0], +A[4][1], +b[4], +A[4][3], +A[4][4], +A[4][5]], [+A[5][0], +A[5][1], +b[5], +A[5][3], +A[5][4], +A[5][5]]]), det([[+A[0][0], +A[0][1], +A[0][2], +b[0], +A[0][4], +A[0][5]], [+A[1][0], +A[1][1], +A[1][2], +b[1], +A[1][4], +A[1][5]], [+A[2][0], +A[2][1], +A[2][2], +b[2], +A[2][4], +A[2][5]], [+A[3][0], +A[3][1], +A[3][2], +b[3], +A[3][4], +A[3][5]], [+A[4][0], +A[4][1], +A[4][2], +b[4], +A[4][4], +A[4][5]], [+A[5][0], +A[5][1], +A[5][2], +b[5], +A[5][4], +A[5][5]]]), det([[+A[0][0], +A[0][1], +A[0][2], +A[0][3], +b[0], +A[0][5]], [+A[1][0], +A[1][1], +A[1][2], +A[1][3], +b[1], +A[1][5]], [+A[2][0], +A[2][1], +A[2][2], +A[2][3], +b[2], +A[2][5]], [+A[3][0], +A[3][1], +A[3][2], +A[3][3], +b[3], +A[3][5]], [+A[4][0], +A[4][1], +A[4][2], +A[4][3], +b[4], +A[4][5]], [+A[5][0], +A[5][1], +A[5][2], +A[5][3], +b[5], +A[5][5]]]), det([[+A[0][0], +A[0][1], +A[0][2], +A[0][3], +A[0][4], +b[0]], [+A[1][0], +A[1][1], +A[1][2], +A[1][3], +A[1][4], +b[1]], [+A[2][0], +A[2][1], +A[2][2], +A[2][3], +A[2][4], +b[2]], [+A[3][0], +A[3][1], +A[3][2], +A[3][3], +A[3][4], +b[3]], [+A[4][0], +A[4][1], +A[4][2], +A[4][3], +A[4][4], +b[4]], [+A[5][0], +A[5][1], +A[5][2], +A[5][3], +A[5][4], +b[5]]]), det(A)] } } var CACHE = [ robustLinearSolve0d, robustLinearSolve1d ] function proc(s0, s1, s2, s3, s4, s5, CACHE, g) { return function dispatchLinearSolve(A, b) { switch (A.length) { case 0: return s0(A, b); case 1: return s1(A, b); case 2: return s2(A, b); case 3: return s3(A, b); case 4: return s4(A, b); case 5: return s5(A, b); } var s = CACHE[A.length]; if (!s) s = CACHE[A.length] = g(A.length); return s(A, b) } } function generateDispatch() { while(CACHE.length < NUM_EXPAND) { CACHE.push(generateSolver(CACHE.length)) } module.exports = proc.apply(undefined, CACHE.concat([CACHE, generateSolver])) for(var i=0; i<NUM_EXPAND; ++i) { module.exports[i] = CACHE[i] } } generateDispatch() /***/ }), /***/ 737: /***/ (function(module) { module.exports = { 0: 'NONE', 1: 'ONE', 2: 'LINE_LOOP', 3: 'LINE_STRIP', 4: 'TRIANGLES', 5: 'TRIANGLE_STRIP', 6: 'TRIANGLE_FAN', 256: 'DEPTH_BUFFER_BIT', 512: 'NEVER', 513: 'LESS', 514: 'EQUAL', 515: 'LEQUAL', 516: 'GREATER', 517: 'NOTEQUAL', 518: 'GEQUAL', 519: 'ALWAYS', 768: 'SRC_COLOR', 769: 'ONE_MINUS_SRC_COLOR', 770: 'SRC_ALPHA', 771: 'ONE_MINUS_SRC_ALPHA', 772: 'DST_ALPHA', 773: 'ONE_MINUS_DST_ALPHA', 774: 'DST_COLOR', 775: 'ONE_MINUS_DST_COLOR', 776: 'SRC_ALPHA_SATURATE', 1024: 'STENCIL_BUFFER_BIT', 1028: 'FRONT', 1029: 'BACK', 1032: 'FRONT_AND_BACK', 1280: 'INVALID_ENUM', 1281: 'INVALID_VALUE', 1282: 'INVALID_OPERATION', 1285: 'OUT_OF_MEMORY', 1286: 'INVALID_FRAMEBUFFER_OPERATION', 2304: 'CW', 2305: 'CCW', 2849: 'LINE_WIDTH', 2884: 'CULL_FACE', 2885: 'CULL_FACE_MODE', 2886: 'FRONT_FACE', 2928: 'DEPTH_RANGE', 2929: 'DEPTH_TEST', 2930: 'DEPTH_WRITEMASK', 2931: 'DEPTH_CLEAR_VALUE', 2932: 'DEPTH_FUNC', 2960: 'STENCIL_TEST', 2961: 'STENCIL_CLEAR_VALUE', 2962: 'STENCIL_FUNC', 2963: 'STENCIL_VALUE_MASK', 2964: 'STENCIL_FAIL', 2965: 'STENCIL_PASS_DEPTH_FAIL', 2966: 'STENCIL_PASS_DEPTH_PASS', 2967: 'STENCIL_REF', 2968: 'STENCIL_WRITEMASK', 2978: 'VIEWPORT', 3024: 'DITHER', 3042: 'BLEND', 3088: 'SCISSOR_BOX', 3089: 'SCISSOR_TEST', 3106: 'COLOR_CLEAR_VALUE', 3107: 'COLOR_WRITEMASK', 3317: 'UNPACK_ALIGNMENT', 3333: 'PACK_ALIGNMENT', 3379: 'MAX_TEXTURE_SIZE', 3386: 'MAX_VIEWPORT_DIMS', 3408: 'SUBPIXEL_BITS', 3410: 'RED_BITS', 3411: 'GREEN_BITS', 3412: 'BLUE_BITS', 3413: 'ALPHA_BITS', 3414: 'DEPTH_BITS', 3415: 'STENCIL_BITS', 3553: 'TEXTURE_2D', 4352: 'DONT_CARE', 4353: 'FASTEST', 4354: 'NICEST', 5120: 'BYTE', 5121: 'UNSIGNED_BYTE', 5122: 'SHORT', 5123: 'UNSIGNED_SHORT', 5124: 'INT', 5125: 'UNSIGNED_INT', 5126: 'FLOAT', 5386: 'INVERT', 5890: 'TEXTURE', 6401: 'STENCIL_INDEX', 6402: 'DEPTH_COMPONENT',