MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / percentile

Function percentile

src/utils/sim3dNormalization.ts:101–108  ·  view source on GitHub ↗
(arr: number[], p: number)

Source from the content-addressed store, hash-verified

99}
100
101function percentile(arr: number[], p: number): number {
102 const sorted = [...arr].sort((a, b) => a - b);
103 const idx = p * (sorted.length - 1);
104 const lower = Math.floor(idx);
105 const upper = Math.ceil(idx);
106 if (lower === upper) return sorted[lower];
107 return sorted[lower] * (upper - idx) + sorted[upper] * (idx - lower);
108}

Callers 1

computeNormalizeScaleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected