+ blocking_force_ = -infinity_f;
+ min_distance_ = length (f);
+ distance_ = max (distance_, min_distance_);
+ update_blocking_force ();
+}
+
+void
+Spring::set_default_strength ()
+{
+ inverse_compress_strength_ = distance_ - min_distance_;
+ inverse_stretch_strength_ = distance_ - min_distance_;
+}
+
+Real
+Spring::length (Real f) const
+{
+ Real force = max (f, blocking_force_);
+ Real inv_k = force < 0.0 ? inverse_compress_strength_ : inverse_stretch_strength_;
+
+ if (isinf (force))
+ {
+ programming_error ("cruelty to springs");
+ force = 0.0;
+ }
+
+ return distance_ + force * inv_k;
+}