SimulationFunction

public protocol SimulationFunction

Conforming types implement a dynamic function that models changes to a vector over time.

  • The type of vector driven by the simulation

    Declaration

    Swift

    associatedtype VectorType : Vector
  • The computed acceleration for a given simulation state.

    Declaration

    Swift

    func acceleration(for state: SimulationState<VectorType>) -> VectorType

    Parameters

    value

    The current value of the simulation.

    velocity

    The current velocity of the simulation.

    Return Value

    A vector containing the acceleration (in units per second) based on value and velocity.

  • Determines whether the simulation can converge (come to rest) for the given state.

    Declaration

    Swift

    func convergence(for state: SimulationState<VectorType>) -> Convergence<VectorType>