]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/spring.hh
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / include / spring.hh
1 /*
2   spring.hh -- declare Spring
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1999--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef SPRING_HH
10 #define SPRING_HH
11
12 #include "lily-proto.hh"
13 #include "smobs.hh"
14
15 class Spring
16 {
17   Real distance_;
18   Real min_distance_;
19
20   Real inverse_stretch_strength_;
21   Real inverse_compress_strength_;
22
23   Real blocking_force_;
24
25   void update_blocking_force ();
26
27   DECLARE_SIMPLE_SMOBS (Spring);
28 public:
29   Spring ();
30   Spring (Real distance, Real min_distance);
31
32   Real distance () const {return distance_;}
33   Real min_distance () const {return min_distance_;}
34   Real inverse_stretch_strength () const {return inverse_stretch_strength_;}
35   Real inverse_compress_strength () const {return inverse_compress_strength_;}
36   Real blocking_force () const {return blocking_force_;}
37   
38   Real length (Real f) const;
39
40   void set_distance (Real);
41   void set_min_distance (Real);
42   void ensure_min_distance (Real);
43   void set_inverse_stretch_strength (Real);
44   void set_inverse_compress_strength (Real);
45   void set_blocking_force (Real);
46   void set_default_strength ();
47
48   void operator*= (Real);
49   bool operator> (Spring const&) const;
50 };
51 DECLARE_UNSMOB (Spring, spring);
52
53 Spring merge_springs (vector<Spring> const &springs);
54
55 #endif /* SPRING_HH */
56