setSpookParams method

void setSpookParams(
  1. double stiffness,
  2. double relaxation,
  3. double timeStep
)

Recalculates a, b, and eps.

The Equation constructor sets typical SPOOK parameters as such:

  • stiffness = 1e7
  • relaxation = 4
  • timeStep= 1 / 60, note the hardcoded refresh rate.

Implementation

void setSpookParams(double stiffness, double relaxation, double timeStep) {
  final double d = relaxation;
  final double k = stiffness;
  final double h = timeStep;
  a = 4.0 / (h * (1 + 4 * d));
  b = 4.0 * d / (1 + 4 * d);
  eps = 4.0 / (h * h * k * (1 + 4 * d));
}