+ distance_ = 1.0;
+ min_distance_ = 1.0;
+ inverse_stretch_strength_ = 1.0;
+ inverse_compress_strength_ = 1.0;
+
+ update_blocking_force ();
+}
+
+Spring::Spring (Real dist, Real min_dist)
+{
+ distance_ = 1.0;
+ min_distance_ = 1.0;
+ inverse_stretch_strength_ = 1.0;
+ inverse_compress_strength_ = 1.0;
+
+ set_distance (dist);
+ set_min_distance (min_dist);
+ set_default_strength ();
+ update_blocking_force ();
+}
+
+void
+Spring::update_blocking_force ()
+{
+ // blocking_force_ is the value of force
+ // below which length(force) is constant, and
+ // above which length(force) varies according to inverse_*_strength.
+ // Simple_spacer::compress_line() depends on the condition above.
+ // We assume inverse_*_strength are non-negative.
+ if (min_distance_ > distance_)
+ if (inverse_stretch_strength_ > 0.0)
+ blocking_force_ = (min_distance_ - distance_) / inverse_stretch_strength_;
+ else
+ // Conceptually, this should be +inf, but 0.0 meets the requirements
+ // of Simple_spacer and creates fewer cases of 0.0*inf to handle.
+ blocking_force_ = 0.0;
+ else if (inverse_compress_strength_ > 0.0)
+ blocking_force_ = (min_distance_ - distance_) / inverse_compress_strength_;
+ else
+ blocking_force_ = 0.0;