DecayFunction
public struct DecayFunction<Vector: VectorType>: DynamicFunctionType
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 settle.
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(value: Vector, velocity: Vector) -> Vector
-
Returns
true
if the simulation can become settled.Declaration
Swift
public func canSettle(value: Vector, velocity: Vector) -> Bool
-
Returns the value to settle on.
Declaration
Swift
public func settledValue(value: Vector, velocity: Vector) -> Vector