DecayFunction
public struct DecayFunction<T>: SimulationFunction where T: Vector
Gradually reduces velocity until it equals Vector.zero
.
-
How close to 0 each component of the velocity must be before the simulation is allowed to converge.
Declaration
Swift
public var threshold: Scalar = 0.1
-
How much to erode the velocity.
Declaration
Swift
public var drag: Scalar = 3.0
-
Creates a new
DecayFunction
instance.Declaration
Swift
public init()
-
Calculates acceleration for a given state of the simulation.
Declaration
Swift
public func acceleration(for state: SimulationState<T>) -> T
-
Declaration
Swift
public func convergence(for state: SimulationState<T>) -> Convergence<T>