SpringDescription.withDampingRatio constructor

SpringDescription.withDampingRatio({
  1. required double mass,
  2. required double stiffness,
  3. double ratio = 1.0,
})

Creates a spring given the mass (m), stiffness (k), and damping ratio (ΞΆ). The damping ratio describes a gradual reduction in a spring oscillation. By using the damping ratio, you can define how rapidly the oscillations decay from one bounce to the next.

The damping ratio is especially useful when trying to determining the type of spring to create. A ratio of 1.0 creates a critically damped spring, > 1.0 creates an overdamped spring and < 1.0 an underdamped one.

See mass and stiffness for the units for those arguments. The damping ratio is unitless.

Implementation

SpringDescription.withDampingRatio({
  required this.mass,
  required this.stiffness,
  double ratio = 1.0,
}) : damping = ratio * 2.0 * math.sqrt(mass * stiffness);