X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsimple-spacer-scheme.cc;h=db326704fcde0a6783452a7f1fe4cade3f9b0627;hb=eb2d142eadbda419637d62e2ef5877b203dc5534;hp=24b6d1c76351f3830d105651c75eb46644332ba8;hpb=87eedcd59f4082cb0841528ad5bc82cb1d1191e3;p=lilypond.git diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc index 24b6d1c763..db326704fc 100644 --- a/lily/simple-spacer-scheme.cc +++ b/lily/simple-spacer-scheme.cc @@ -17,7 +17,7 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", 4, 1, 0, (SCM springs, SCM rods, SCM length, SCM ragged), "Solve a spring and rod problem for @var{count} objects, that " "are connected by @var{count-1} springs, and an arbitrary number of rods " - "Springs have the format (ideal, hooke) and rods (idx1, idx2, distance) " + "Springs have the format (ideal, inverse_hooke) and rods (idx1, idx2, distance) " "@var{length} is a number, @var{ragged} a boolean " "Return: a list containing the force (positive for stretching, " "negative for compressing and #f for non-satisfied constraints) " @@ -28,18 +28,17 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", return scm_list_2 (scm_from_double (0.0), scm_from_double (0.0)); SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs"); - SCM_ASSERT_TYPE (scm_ilength (rods) >= 0, rods, SCM_ARG2, __FUNCTION__, "list of rods"); - SCM_ASSERT_TYPE (scm_is_number (length) || length == SCM_BOOL_F, - length, SCM_ARG3, __FUNCTION__, "number or #f"); + SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods"); + LY_ASSERT_TYPE (scm_is_number, length, 3); bool is_ragged = ragged == SCM_BOOL_T; Simple_spacer spacer; for (SCM s = springs; scm_is_pair (s); s = scm_cdr (s)) { Real ideal = scm_to_double (scm_caar (s)); - Real hooke = scm_to_double (scm_cadar (s)); + Real inv_hooke = scm_to_double (scm_cadar (s)); - spacer.add_spring (ideal, 1 / hooke); + spacer.add_spring (ideal, inv_hooke); } for (SCM s = rods; scm_is_pair (s); s = scm_cdr (s))