MCPcopy
hub / github.com/donmccurdy/glTF-Transform / getMax

Method getMax

packages/core/src/properties/accessor.ts:280–297  ·  view source on GitHub ↗

* Maximum value of each component in this attribute. Values returned by this method do not * reflect normalization: use .getMinNormalized in that case.

(target: number[])

Source from the content-addressed store, hash-verified

278 * reflect normalization: use {@link .getMinNormalized} in that case.
279 */
280 public getMax(target: number[]): number[] {
281 const array = this.get('array');
282 const count = this.getCount();
283 const elementSize = this.getElementSize();
284
285 for (let j = 0; j < elementSize; j++) target[j] = -Infinity;
286
287 for (let i = 0; i < count * elementSize; i += elementSize) {
288 for (let j = 0; j < elementSize; j++) {
289 const value = array![i + j];
290 if (Number.isFinite(value)) {
291 target[j] = Math.max(target[j], value);
292 }
293 }
294 }
295
296 return target;
297 }
298
299 /**********************************************************************************************
300 * Layout.

Callers 5

getMaxNormalizedMethod · 0.95
accessor.test.tsFile · 0.45
createAccessorDefMethod · 0.45
getQuantizationSettingsFunction · 0.45
listAnimationsFunction · 0.45

Calls 3

getCountMethod · 0.95
getElementSizeMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected