- if (distance <= 0.0 || inverse_strength < 0.0)
- {
- programming_error ("adding reverse spring, setting to unit");
- distance = 1.0;
- inverse_strength = 1.0;
- }
-
- if (isinf (distance) || isnan (distance)
- || isnan (inverse_strength))
- {
- /* strength == INF is possible. It means fixed distance. */
- programming_error ("insane distance found");
- distance = 1.0;
- inverse_strength = 1.0;
- }
-
-#ifndef NDEBUG
- SCM mins = me->get_object ("ideal-distances");
- for (SCM s = mins; scm_is_pair (s); s = scm_cdr (s))
- {
- Spring_smob *sp = unsmob_spring (scm_car (s));
- if (sp->other_ == other)
- {
- programming_error ("already have that spring");
- return;
- }
- }
-#endif
-
- Spring_smob spring;
- spring.inverse_strength_ = inverse_strength;
- spring.distance_ = distance;
- spring.other_ = other;
-