// 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
- if (inverse_compress_strength_ > 0.0)
- blocking_force_ = (min_distance_ - distance_) / inverse_compress_strength_;
- else
- blocking_force_ = 0.0;
+ blocking_force_ = 0.0;
}
/* scale a spring, but in a way that doesn't violate min_distance */
void
-Spring::operator*= (Real r)
+Spring::operator *= (Real r)
{
distance_ = max (min_distance_, distance_ * r);
inverse_compress_strength_ = max (0.0, distance_ - min_distance_);
}
bool
-Spring::operator> (Spring const &other) const
+Spring::operator > (Spring const &other) const
{
return blocking_force_ > other.blocking_force_;
}
Real force = max (f, blocking_force_);
Real inv_k = force < 0.0 ? inverse_compress_strength_ : inverse_stretch_strength_;
- if (isinf(force))
+ if (isinf (force))
{
programming_error ("cruelty to springs");
force = 0.0;