]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.76
authorfred <fred>
Sun, 24 Mar 2002 19:48:18 +0000 (19:48 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:48:18 +0000 (19:48 +0000)
lily/include/linespace.hh
lily/include/p-score.hh

index 97e4caf70ce25940ff437571b5468ed1f78c861c..587ecf912c7e8f21ed80e6c5f94cdb8c424c30f6 100644 (file)
@@ -6,6 +6,7 @@
   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#error
 
 #ifndef LINESPACE_HH
 #define LINESPACE_HH
 #include "interval.hh"
 #include "pointer.hh"
 
-/// helper struct for #Spacing_problem#
-struct Colinfo {
-    PCol *pcol_l_;
-    P<Real> fixpos_p_;
-    Interval width;
-    int rank_i_;
-    /// did some tricks to make this column come out.
-    bool ugh_b_;               
-    /* *************** */
-    Colinfo();
-    Colinfo(PCol *,Real const *);
-
-    void print() const;
-    bool fixed() const { return fixpos_p_.get_C();}
-    Real fixed_position()const { return *fixpos_p_; }
-    Real minright() const { return width.right; }
-    Real minleft() const { return -width.left; }
-};
-
 
 /** the problem, given by the columns (which include constraints) and
     intercolumn spacing. The problem is:
@@ -59,7 +41,7 @@ struct Colinfo {
 
 */
 class Spacing_problem {
-    Array<Idealspacing const *> ideals;
+    PointerList<Idealspacing *> ideal_p_list_;
     Array<Colinfo> cols;
     Array<Colinfo> loose_col_arr_;
     
@@ -86,18 +68,7 @@ class Spacing_problem {
 
     void handle_loose_cols();
     void position_loose_cols(Vector &) const;
-public:
-    Array<PCol*> error_pcol_l_arr() const;
-
-    /** solve the spacing problem
-      
-      @return the column positions, and the energy (last element)
-
-      */
-    Array<Real> solve() const;
-
-    
-    /**
+   /**
        add a idealspacing to the problem.
       
     One pair of columns can have no, one or more idealspacings,
@@ -105,23 +76,27 @@ public:
     not in this problem, the spacing is ignored.
     */
     void add_ideal(Idealspacing const *i);
-    
-    
-    /** add a col to the problem. columns have to be added left to right. The column contains
-      info on it's minimum width.
-    */
-    void add_column(PCol  *, bool fixed=false, Real fixpos=0.0);
+    void print_ideal(Idealspacing const *)const; 
+    Vector try_initial_solution() const;
+    void calcideal();
 
+    Score_column* scol_l(int);
+    void connect(int i,int j, Real,Real);
+public:
+    static Line_spacer *constructor() {
+       return new Line_spacer;
+    }
+    Array<PCol*> error_pcol_l_arr() const;
 
-    bool check_constraints(Vector v) const;
+    virtual   Array<Real> solve() const;
+    virtual  void add_column(PCol  *, bool fixed=false, Real fixpos=0.0);
 
-    Vector try_initial_solution() const;
-    void OK() const;
-    void print() const;
-    void print_ideal(Idealspacing const *)const;
-    void prepare();
+    virtual Vector default_solution() contains { 
+       return try_initial_solution() ; 
+    }
+    virtual   bool check_constraints(Vector v) const;
+    virtual    void OK() const;
+    virtual    void print() const;
+    virtual    void prepare();
 };
-
-
-#endif
index 32231f6371415397c2f99f3d1573d7aea854a620..596e718c418808e00f351528734d34297ca582a8 100644 (file)
@@ -25,13 +25,13 @@ public:
     Paper_def *paper_l_;
 
     /// the columns, ordered left to right
-    Pointer_list<PCol *> cols;
+    Pointer_list<PCol *> col_p_list_;
 
     /// the idealspacings, no particular order
-    Pointer_list<Idealspacing*> suz;
+    Pointer_list<Idealspacing*> suz_p_list_;
 
     /// crescs etc; no particular order
-    Pointer_list<Spanner *> spanners;
+    Pointer_list<Spanner *> span_p_list_;
 
     /// other elements
     Pointer_list<Score_elem*> elem_p_list_;
@@ -71,14 +71,6 @@ public:
 
     /* UTILITY ROUTINES */
 
-    /// get the spacing between c1 and c2, create one if necessary.
-    Idealspacing* get_spacing(PCol *c1, PCol *c2);
-
-    /// connect c1 and c2
-    void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
-
-    /// connect c1 and c2 and any children of c1 and c2
-    void connect(PCol* c1, PCol *c2, Real distance_f,Real  strength_f= 1.0);
     
     /* STANDARD ROUTINES */
     void OK()const;
@@ -94,6 +86,7 @@ private:
     /// before calc_breaking
     void preprocess();
 
+    void calc_idealspacing();
     /// calculate where the lines are to be broken, and use results
     void calc_breaking();