Documentation
    Preparing search index...

    Class ParametricTrajectory

    §13's "custom parametric trajectory": any position function of time.

    new ParametricTrajectory({
    duration: 4,
    position: (t, out) => out.set(Math.cos(t), Math.sin(t), t * 0.1),
    });

    Velocity and acceleration are central differences with h = {@link CENTRAL_DIFFERENCE_STEP} (see the module note on why that value). The callback is invoked twice per velocity sample and three times per acceleration sample.

    The three scratch vectors are per instance, so sampling allocates nothing when out is passed — provided the callback does not allocate either. Each callback result is copied into scratch before the next call, so a callback that ignores out and returns its own vector still produces correct differences.

    Implements

    Index
    duration: number

    Natural extent of the path in seconds. See the module note on extrapolation.

    • Second derivative of position at time, per second squared. Writes into out when given.

      Parameters

      Returns Vector3

    • Position at time seconds. Writes into out when given.

      Parameters

      Returns Vector3

    • First derivative of position at time, per second. Writes into out when given.

      Parameters

      Returns Vector3