Browse Source

high slurs: fine-tune flattening parameters (#971)

fixes arc in long steep chopin sample when display width is shorter,
and improves some samples:

ticks.mxl_1 1.9902
test_slurs_long_steep_arc_flattening_chopin.musicxml_1 1.96953
OSMD_function_test_all.xml_1 0.26723
tick_width.musicxml_1 0.0513705
JosephHaydn_ConcertanteCello.xml_1 0.0180239
Dichterliebe01.xml_1 0.00357593
Mozart_Clarinet_Quintet_Excerpt.mxl_1 0.000215483
sschmid 4 years ago
parent
commit
c146249b4a

+ 4 - 4
src/MusicalScore/Graphical/EngravingRules.ts

@@ -474,10 +474,10 @@ export class EngravingRules {
         this.SlurTangentMinAngle = 30.0;
         this.SlurTangentMaxAngle = 80.0;
         this.SlurHeightFactor = 1; // 1 = 100% (standard height). 2 = 100% flattening of all slurs.
-        this.SlurHeightFlattenLongSlursFactorByWidth = 0.9; // additional flattening for long slurs the longer they are.
-        this.SlurHeightFlattenLongSlursFactorByAngle = 0.1; // this has a very strong effect on the curve, even with small increases.
-        this.SlurHeightFlattenLongSlursCutoffAngle = 55;
-        this.SlurHeightFlattenLongSlursCutoffWidth = 15;
+        this.SlurHeightFlattenLongSlursFactorByWidth = 0.24; // additional flattening for long slurs the longer they are.
+        this.SlurHeightFlattenLongSlursFactorByAngle = 0.36; // when one of these factors is high, increasing the other has a very strong effect.
+        this.SlurHeightFlattenLongSlursCutoffAngle = 47;
+        this.SlurHeightFlattenLongSlursCutoffWidth = 16; // 15 ~ slur between measure's first notes in 4/4. 14 -> problem with test_slurs_highNotes
         this.SlursStartingAtSameStaffEntryYOffset = 0.8;
 
         // Repetitions

+ 1 - 0
src/MusicalScore/Graphical/GraphicalSlur.ts

@@ -876,6 +876,7 @@ export class GraphicalSlur extends GraphicalCurve {
         let widthFlattenFactor: number = 1;
         const cutoffAngle: number = this.rules.SlurHeightFlattenLongSlursCutoffAngle;
         const cutoffWidth: number = this.rules.SlurHeightFlattenLongSlursCutoffWidth;
+        // console.log("width: " + endX);
         if (startAngle > cutoffAngle && endX > cutoffWidth) { // steep and wide slurs
             // console.log("steep angle: " + startAngle);
             widthFlattenFactor += endX / 70 * this.rules.SlurHeightFlattenLongSlursFactorByWidth; // double flattening for width = 70, factorByWidth = 1