isOverstretched method

bool isOverstretched(
  1. double ratio
)

True when the spring is longer than ratio x its resting length.

Implementation

bool isOverstretched(double ratio) {
  final double dx = p2.x - p1.x;
  final double dy = p2.y - p1.y;
  final double dz = p2.z - p1.z;
  return dx * dx + dy * dy + dz * dz > restSquared * ratio * ratio;
}