MCPcopy Create free account
hub / github.com/microsoft/SandDance / getGPUAggregationParams

Function getGPUAggregationParams

docs/tests/v2/es6/js/sanddance.js:62005–62033  ·  view source on GitHub ↗
(_ref2)

Source from the content-addressed store, hash-verified

62003
62004
62005function getGPUAggregationParams(_ref2) {
62006 var boundingBox = _ref2.boundingBox,
62007 cellSize = _ref2.cellSize,
62008 worldOrigin = _ref2.worldOrigin;
62009 var yMin = boundingBox.yMin,
62010 yMax = boundingBox.yMax,
62011 xMin = boundingBox.xMin,
62012 xMax = boundingBox.xMax; // NOTE: this alignment will match grid cell boundaries with existing CPU implementation
62013 // this gurantees identical aggregation results when switching between CPU and GPU aggregation.
62014 // Also gurantees same cell boundaries, when overlapping between two different layers (like ScreenGrid and Contour)
62015 // We first move worldOrigin to [0, 0], align the lower bounding box , then move worldOrigin to its original value.
62016
62017 var originX = alignToCell(xMin - worldOrigin[0], cellSize[0]) + worldOrigin[0];
62018 var originY = alignToCell(yMin - worldOrigin[1], cellSize[1]) + worldOrigin[1]; // Setup transformation matrix so that every point is in +ve range
62019
62020 var gridTransformMatrix = new _math.Matrix4().translate([-1 * originX, -1 * originY, 0]); // const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
62021
62022 var gridOrigin = [originX, originY];
62023 var width = xMax - xMin + cellSize[0];
62024 var height = yMax - yMin + cellSize[1];
62025 var gridSize = [Math.ceil(width / cellSize[0]), Math.ceil(height / cellSize[1])];
62026 return {
62027 gridOrigin: gridOrigin,
62028 gridSize: gridSize,
62029 width: width,
62030 height: height,
62031 gridTransformMatrix: gridTransformMatrix
62032 };
62033}
62034},{"../../../utils/assert":"R2tg","math.gl":"o5CE","luma.gl":"iiNl","../../../lib/constants":"hXbg","../../../utils/iterable-utils":"ZNUc","../../../utils/count":"frIP","./gpu-grid-aggregator-constants":"ReP4"}],"P3tH":[function(require,module,exports) {
62035"use strict";
62036

Callers 1

pointToDensityGridDataFunction · 0.85

Calls 2

alignToCellFunction · 0.85
translateMethod · 0.45

Tested by

no test coverage detected