]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/simple-spacer.hh
* lily/simple-spacer.cc (LY_DEFINE): ly_solve_spring_rod_problem:
[lilypond.git] / lily / include / simple-spacer.hh
1 /*   
2   simple-spacer.hh -- declare Simple_spacer
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef SIMPLE_SPACER_HH
11 #define SIMPLE_SPACER_HH
12
13 #include "parray.hh"
14 #include "lily-proto.hh"
15 #include "smobs.hh"
16
17 struct Spring_description
18 {
19   Real ideal_;
20   Real hooke_;
21   bool is_active_;
22   Real block_force_;
23
24   Real length (Real force) const;
25   Spring_description ();
26
27   bool is_sane () const;
28 };
29
30 class Simple_spacer
31 {
32 public:
33   Array<Spring_description> springs_;
34   Real force_;
35   Real indent_;
36   Real line_len_;
37   Real default_space_;
38   int active_count_;
39
40   Simple_spacer ();
41   
42   
43   void my_solve_linelen ();
44   void my_solve_natural_len ();
45   Real active_springs_stiffness () const;
46   Real range_stiffness (int, int) const;
47   void add_rod (int l, int r, Real dist);
48   void add_spring (Real, Real);
49   Real range_ideal_len (int l, int r) const;
50   Real active_blocking_force ()const;
51   Real configuration_length ()const;
52   void set_active_states ();
53   bool is_active () const;
54
55   DECLARE_SIMPLE_SMOBS(Simple_spacer, );
56 };
57
58
59 struct Simple_spacer_wrapper
60 {
61   Simple_spacer *spacer_;
62   Link_array<Grob> spaced_cols_;
63   Link_array<Grob> loose_cols_;
64
65   Simple_spacer_wrapper ();
66   void add_columns (Link_array<Grob> const &);
67   void solve (Column_x_positions *, bool);
68   ~Simple_spacer_wrapper();
69 private:
70   Simple_spacer_wrapper(Simple_spacer_wrapper const&);
71 };
72
73 #endif /* SIMPLE_SPACER_HH */
74