babylon.quarks - v1.0.0
    Preparing search index...

    Class PiecewiseFunction<T>Abstract

    A function over [0, 1] made of pieces, each a function of type T with the x it starts at; a piece runs to the next one's start, the last to 1.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index
    functions: [T, number][]

    The pieces as [function, startX], sorted by start; the first starts at 0.

    • get numOfFunctions(): number

      How many pieces there are.

      Returns number

    • The index of the piece t falls in, or -1 when t is outside [0, 1] or there are no pieces.

      Parameters

      • t: number

      Returns number

    • The x where piece index ends: the next piece's start, or 1 for the last.

      Parameters

      • index: number

      Returns number

    • The function of piece index.

      Parameters

      • index: number

      Returns T

    • The x where piece index starts.

      Parameters

      • index: number

      Returns number

    • Inserts func as a piece starting at t, after the pieces that start at or before it, so the pieces stay sorted. t is clamped to [0, 1].

      Parameters

      • t: number
      • func: T

      Returns void

    • Removes piece index.

      Parameters

      • index: number

      Returns T

      Its function.

    • Moves the end of piece index, the next piece's start; the last piece always ends at 1, so it is ignored there.

      Parameters

      • index: number
      • x: number

      Returns void

    • Replaces the function of piece index.

      Parameters

      • index: number
      • func: T

      Returns void

    • Moves the start of piece index; the first piece always starts at 0, so index 0 is ignored.

      Parameters

      • index: number
      • x: number

      Returns void