From 063dabccbf2c05a3d0122e8521bc409d312e35ea Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:16:47 +0000 Subject: [PATCH] lilypond-1.3.19 --- flower/include/fproto.hh | 78 ------------------ lily/bow.cc | 169 --------------------------------------- lily/leastsquares.cc | 42 ---------- 3 files changed, 289 deletions(-) delete mode 100644 flower/include/fproto.hh delete mode 100644 lily/bow.cc delete mode 100644 lily/leastsquares.cc diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh deleted file mode 100644 index 9983eef245..0000000000 --- a/flower/include/fproto.hh +++ /dev/null @@ -1,78 +0,0 @@ -/* - fproto.hh -- typenames in flowerlib - - (c) 1996 Han-Wen Nienhuys -*/ - -#ifndef FPROTO_HH -#define FPROTO_HH - - -char const * flower_version_sz(); - -template struct Link_array; -template struct Array; -template struct sstack; -template struct Assoc; -template struct Hash_table; -template struct Hash_table_iter; -template struct Dictionary_iter; -template struct Dictionary; -template struct Dictionary_iter; -template struct List; -template struct Link_list; -template struct Pointer_list; -template struct Cursor; -template struct PCursor; -template struct Link; -template struct Handle; -template struct Interval_t; -template struct PQueue; - -#include "real.hh" - -typedef Interval_t Interval; -typedef Interval_t Slice; - -struct Choleski_decomposition; - -struct Long_option_init; -struct File_path; -struct Directed_graph_node; -struct Getopt_long; -struct Matrix; -struct String_data; -struct FlowerString; -struct String_handle; -struct String_convert; -struct String; -struct Matrix_storage; -struct Vector ; -struct MyRational; - - -#if PARANOIA -#ifndef Rational -#define Rational MyRational -#endif -#else -struct Rational; -#endif - -struct Text_stream; -struct Data_file; -struct Text_db; -struct Scalar; - -typedef unsigned char U8; -typedef short I16; -typedef unsigned short U16; -typedef unsigned U32; -typedef int I32; -typedef long long I64; - -typedef unsigned char Byte; - - -#endif // FPROTO_HH - diff --git a/lily/bow.cc b/lily/bow.cc deleted file mode 100644 index 2fbb65d309..0000000000 --- a/lily/bow.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* - bow.cc -- implement Bow - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ - -#include "dimension-cache.hh" -#include "bow.hh" -#include "debug.hh" -#include "paper-def.hh" -#include "molecule.hh" -#include "lookup.hh" -#include "bezier-bow.hh" -#include "main.hh" -#include "directional-element-interface.hh" - -Bow::Bow () -{ - dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0; - dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; -} - -Molecule* -Bow::do_brew_molecule_p () const -{ - Real thick = paper_l ()->get_var ("slur_thickness"); - Bezier one = get_curve (); - - Molecule a; - SCM d = get_elt_property ("dashed"); - if (gh_number_p (d)) - a = lookup_l ()->dashed_slur (one, thick, gh_scm2int (d)); - else - a = lookup_l ()->slur (one, directional_element (this).get () * thick, thick); - - return new Molecule (a); -} - -Offset -Bow::center () const -{ - Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; - Real dx = extent(X_AXIS).length (); - - return Offset (dx / 2, dy); -} - - -Interval -Bow::curve_extent (Axis a) const -{ - return get_curve ().extent (a); -} - -Bezier -Bow::get_curve () const -{ - Bezier_bow b (get_encompass_offset_arr (), directional_element (this).get ()); - - b.ratio_ = paper_l ()->get_var ("slur_ratio"); - b.height_limit_ = paper_l ()->get_var ("slur_height_limit"); - b.rc_factor_ = paper_l ()->get_var ("slur_rc_factor"); - - b.calculate (); - return b.get_curve (); -} - -#if 0 - -/* - TODO: FIXME. - */ - -/* - Clipping - - This function tries to address two issues: - * the tangents of the slur should always point inwards - in the actual slur, i.e. *after rotating back*. - - * slurs shouldn't be too high - let's try : h <= 1.2 b && h <= 3 staffheight? - - We could calculate the tangent of the bezier curve from - both ends going inward, and clip the slur at the point - where the tangent (after rotation) points up (or inward - with a certain maximum angle). - - However, we assume that real clipping is not the best - answer. We expect that moving the outer control point up - if the slur becomes too high will result in a nicer slur - after recalculation. - - Knowing that the tangent is the line through the first - two control points, we'll clip (move the outer control - point upwards) too if the tangent points outwards. - */ - -bool -Bezier_bow::calc_clipping () -{ - Real clip_height = paper_l_->get_var ("slur_clip_height"); - Real clip_ratio = paper_l_->get_var ("slur_clip_ratio"); - Real clip_angle = paper_l_->get_var ("slur_clip_angle"); - - Real b = curve_.control_[3][X_AXIS] - curve_.control_[0][X_AXIS]; - Real clip_h = clip_ratio * b ? begin_h - clip_h; - Real end_dy = 0 >? end_h - clip_h; - - Real pi = M_PI; - Real begin_alpha = (curve_.control_[1] - curve_.control_[0]).arg () + dir_ * alpha_; - Real end_alpha = pi - (curve_.control_[2] - curve_.control_[3]).arg () - dir_ * alpha_; - - Real max_alpha = clip_angle / 90 * pi / 2; - if ((begin_dy < 0) && (end_dy < 0) - && (begin_alpha < max_alpha) && (end_alpha < max_alpha)) - return false; - - transform_back (); - - if ((begin_dy > 0) || (end_dy > 0)) - { - Real dy = (begin_dy + end_dy) / 4; - dy *= cos (alpha_); - encompass_[0][Y_AXIS] += dir_ * dy; - encompass_.top ()[Y_AXIS] += dir_ * dy; - } - else - { - //ugh - Real c = 0.4; - if (begin_alpha >= max_alpha) - begin_dy = 0 >? c * begin_alpha / max_alpha * begin_h; - if (end_alpha >= max_alpha) - end_dy = 0 >? c * end_alpha / max_alpha * end_h; - - encompass_[0][Y_AXIS] += dir_ * begin_dy; - encompass_.top ()[Y_AXIS] += dir_ * end_dy; - - Offset delta = encompass_.top () - encompass_[0]; - alpha_ = delta.arg (); - } - - to_canonic_form (); - - return true; -} -#endif - - - -Array -Bow::get_encompass_offset_arr () const -{ - Array offset_arr; - offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT])); - offset_arr.push (Offset (spanner_length () + dx_f_drul_[RIGHT], - dy_f_drul_[RIGHT])); - - return offset_arr; -} - - diff --git a/lily/leastsquares.cc b/lily/leastsquares.cc deleted file mode 100644 index 6856c625b3..0000000000 --- a/lily/leastsquares.cc +++ /dev/null @@ -1,42 +0,0 @@ -#include "leastsquares.hh" -#include "warn.hh" - -void -Least_squares::OK() const -{ - assert (input.size() > 1); - Real dx = 0.0; - for (int i=1; i < input.size(); i++) - dx += abs (input[i-1][X_AXIS] - input[i][X_AXIS]); - - assert (dx); -} - -void -Least_squares::minimise (Real &coef, Real &offset) -{ - Real sx = 0.0; - Real sy = 0.0; - Real sqx =0.0; - Real sxy = 0.0; - - for (int i=0; i < input.size();i++) - { - Real x=input[i][X_AXIS]; - Real y = input[i][Y_AXIS]; - sx += x; - sy += y; - sqx += sqr (x); - sxy += x*y; - } - int N = input.size(); - - coef =0.0; - offset =0.; - - Real den = (N*sqx - sqr (sx)); - if (!N || !den) - programming_error ("Least_squares::minimise(): Nothing to minimise"); - coef = (N * sxy - sx*sy)/den; - offset = (sy - coef * sx)/N; -} -- 2.39.5