AlexAegis/loreplotter

View on GitHub
src/app/function/enclosing-progress.function.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Enclosing, Node } from '@alexaegis/avl';
import { ActorDelta, UnixWrapper } from '@app/model/data';
import { Math as ThreeMath } from 'three';

export function enclosingProgress(enclosure: Enclosing<Node<UnixWrapper, ActorDelta>>, unix: number): number {
    return ThreeMath.mapLinear(
        unix,
        enclosure.last ? enclosure.last.k.unix : -Infinity,
        enclosure.first ? enclosure.first.k.unix : Infinity,
        0,
        1
    );
}