DampingPolicy class

Utility for computing and classifying spring damping coefficients.

Usage:

final policy = DampingPolicy();
final c = policy.computeDamping(mass: 1.0, stiffness: 180.0, zeta: 0.5);

Constructors

DampingPolicy({double defaultZeta = 1.0})
const

Properties

defaultZeta double
Default damping ratio (ζ) applied when none is specified.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

classify(double zeta) DampingKind
Classifies a damping ratio zeta into under/critical/over-damped.
computeDamping({required double mass, required double stiffness, double? zeta}) double
Computes the damping coefficient c for a given zeta (damping ratio).
computeZeta({required double mass, required double stiffness, required double damping}) double
Computes the damping ratio ζ from a known damping coefficient c.
criticalDamping({required double mass, required double stiffness}) double
Computes the critical damping value for a mass-spring system.
dampedFrequency({required double mass, required double stiffness, required double zeta}) double?
Computes the damped frequency ωd = ω₀·√(1 - ζ²) for under-damped systems. Returns null for critical or over-damped systems.
estimateSettleTime({required double zeta, required double naturalFreq}) double
Estimates settle time (5% criterion) for an under-damped system.
isCritical(double zeta) bool
True if zeta == 1.0 (±0.001 tolerance).
isOverdamped(double zeta) bool
True if zeta > 1.0 (no oscillation, slow).
isUnderdamped(double zeta) bool
True if zeta < 1.0 (will oscillate).
naturalFrequency({required double mass, required double stiffness}) double
Computes the natural angular frequency ω₀.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

heavy → const DampingPolicy
Heavily over-damped — slow, no oscillation.
noBounce → const DampingPolicy
Critically damped policy — used for UI elements requiring no bounce.
springy → const DampingPolicy
Clearly under-damped — noticeable spring wobble.
subtle → const DampingPolicy
Slightly under-damped — subtle spring feel.