Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "math/additive"

Index

Functions

Functions

Const additive

  • additive<T>(type: T, fn: Fn<Term<T>, FloatTerm>, oct?: number | FloatTerm, name?: string): TaggedFn3<T, T, "float", "float">
  • Higher order function. Takes an AST type ID, a single-arg scalar function fn, number of octaves (default: 4) and an optional function name. Returns a new function which computes the summed value of fn over the given number octaves and accepts 3 args:

    • position (float)
    • octave shift (float)
    • octave decay (usually 0.5)

    For each octave i [0..oct), the function is (in principle) evaluated as:

    n += decay / exp2(i) * fn(pos * exp2(i) + i * shift)

    Type parameters

    • T: Prim

    Parameters

    • type: T
    • fn: Fn<Term<T>, FloatTerm>

      -

    • Default value oct: number | FloatTerm = 4

      -

    • Default value name: string = "additive"

      -

    Returns TaggedFn3<T, T, "float", "float">

Generated using TypeDoc