SpringSimulation constructor

SpringSimulation(
  1. SpringDescription spring,
  2. double start,
  3. double end,
  4. double velocity, {
  5. Tolerance tolerance = Tolerance.defaultTolerance,
})

Creates a spring simulation from the provided spring description, start distance, end distance, and initial velocity.

The units for the start and end distance arguments are arbitrary, but must be consistent with the units used for other lengths in the system.

The units for the velocity are L/T, where L is the aforementioned arbitrary unit of length, and T is the time unit used for driving the SpringSimulation.

Implementation

SpringSimulation(
  SpringDescription spring,
  double start,
  double end,
  double velocity, {
  super.tolerance,
}) : _endPosition = end,
     _solution = _SpringSolution(spring, start - end, velocity);