DecayFunction
public struct DecayFunction<T> : SimulationFunction where T : VectorConvertible
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: Double
-
How much to erode the velocity.
Declaration
Swift
public var drag: Double
-
Creates a new
DecayFunction
instance.Declaration
Swift
public init(threshold: Double = 0.1, drag: Double = 3.0)
-
Calculates acceleration for a given state of the simulation.
Declaration
Swift
public func acceleration(value: T.VectorType, velocity: T.VectorType) -> T.VectorType
-
Declaration
Swift
public func convergence(value: T.VectorType, velocity: T.VectorType) -> Convergence<T>