X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsimple-spacer-scheme.cc;h=462600b2dc535a316d1ad6b88c65be5c55792747;hb=ab9e3136d78bfaf15cc6d77ed1975d252c3fe506;hp=db326704fcde0a6783452a7f1fe4cade3f9b0627;hpb=e98bc7bfabf41d75aa1e80f37cec7957065f9396;p=lilypond.git diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc index db326704fc..462600b2dc 100644 --- a/lily/simple-spacer-scheme.cc +++ b/lily/simple-spacer-scheme.cc @@ -1,9 +1,20 @@ /* - simple-spacer-scheme.cc -- implement Simple_spacer + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2005--2010 Han-Wen Nienhuys - (c) 2005--2007 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include @@ -15,13 +26,19 @@ 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, 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) " - "followed by the @var{spring-count}+1 positions of the objects. ") + "Solve a spring and rod problem for @var{count} objects, that" + " are connected by @var{count}-1 @var{springs}, and an arbitrary" + " number of @var{rods}. @var{count} is implicitly given by" + " @var{springs} and @var{rods}. The @var{springs} argument has" + " the format @code{(ideal, inverse_hook)} and @var{rods} is of" + " the form @code{(idx1, idx2, distance)}.\n" + "\n" + "@var{length} is a number, @var{ragged} a boolean.\n" + "\n" + "The function returns a list containing the force (positive for" + " stretching, negative for compressing and @code{#f} for" + " non-satisfied constraints) followed by @var{spring-count}+1" + " positions of the objects.") { int len = scm_ilength (springs); if (len == 0) @@ -38,7 +55,11 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", Real ideal = scm_to_double (scm_caar (s)); Real inv_hooke = scm_to_double (scm_cadar (s)); - spacer.add_spring (ideal, inv_hooke); + Spring sp (ideal, 0.0); + sp.set_inverse_compress_strength (inv_hooke); + sp.set_inverse_stretch_strength (inv_hooke); + + spacer.add_spring (sp); } for (SCM s = rods; scm_is_pair (s); s = scm_cdr (s))