MCPcopy
hub / github.com/microsoft/SandDance / minMaxPoints

Function minMaxPoints

packages/sanddance/src/axisSelection.ts:133–156  ·  view source on GitHub ↗
(lines: VegaDeckGl.types.StyledLine[])

Source from the content-addressed store, hash-verified

131}
132
133function minMaxPoints(lines: VegaDeckGl.types.StyledLine[]) {
134 const points: number[][] = [];
135 lines.forEach(line => {
136 [line.sourcePosition, line.targetPosition].forEach(point => {
137 points.push(point);
138 });
139 });
140 return [0, 1].map(dim => {
141 const minMax: { min: number, max: number } = { min: null, max: null };
142 points.forEach(point => {
143 if (minMax.max == null) {
144 minMax.max = point[dim];
145 } else {
146 minMax.max = Math.max(minMax.max, point[dim]);
147 }
148 if (minMax.min == null) {
149 minMax.min = point[dim];
150 } else {
151 minMax.min = Math.min(minMax.min, point[dim]);
152 }
153 });
154 return minMax;
155 });
156}

Callers 1

facetSelectionPolygonsFunction · 0.70

Calls 3

forEachMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected