projects/maplander/components/src/lib/utils/classes/mUtils.ts
Methods |
|
Static linSpaceExp |
linSpaceExp(start: number, stop: number, n: number)
|
Returns :
number[]
|
export class MUtils {
static linSpaceExp(start: number, stop: number, n: number): number[] {
const list: number[] = [];
const phi = 1.618033988749895, b = Math.log(stop / start) / ((n - 1) * Math.log(phi));
for (let i = 0; i < n; i++) {
list[i] = start * Math.pow(phi, b * i);
const length = (Math.log10(list[i]) + 1);
if (length > 2) {
list[i] = (Math.round(list[i] / Math.pow(10, length - 2)) * Math.pow(10, length - 2));
}
}
return list;
}
}