]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/spring.hh
Run grand-replace (issue 3765)
[lilypond.git] / lily / include / spring.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1999--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef SPRING_HH
21 #define SPRING_HH
22
23 #include "lily-proto.hh"
24 #include "smobs.hh"
25
26 class Spring
27 {
28   Real distance_;
29   Real min_distance_;
30
31   Real inverse_stretch_strength_;
32   Real inverse_compress_strength_;
33
34   Real blocking_force_;
35
36   void update_blocking_force ();
37
38   DECLARE_SIMPLE_SMOBS (Spring);
39 public:
40   Spring ();
41   Spring (Real distance, Real min_distance);
42
43   Real distance () const {return distance_;}
44   Real min_distance () const {return min_distance_;}
45   Real inverse_stretch_strength () const {return inverse_stretch_strength_;}
46   Real inverse_compress_strength () const {return inverse_compress_strength_;}
47   Real blocking_force () const {return blocking_force_;}
48
49   Real length (Real f) const;
50
51   void set_distance (Real);
52   void set_min_distance (Real);
53   void ensure_min_distance (Real);
54   void set_inverse_stretch_strength (Real);
55   void set_inverse_compress_strength (Real);
56   void set_blocking_force (Real);
57   void set_default_strength ();
58   void set_default_compress_strength ();
59   void set_default_stretch_strength ();
60
61   void operator *= (Real);
62   bool operator > (Spring const &) const;
63 };
64 DECLARE_UNSMOB (Spring, spring);
65
66 Spring merge_springs (vector<Spring> const &springs);
67
68 #endif /* SPRING_HH */
69