From 29fa955b89cdee244adcfc8a176ecb212485064d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 19 Feb 2008 22:14:34 +0100 Subject: [PATCH] tentative fix for issue 3 (ex 53) --- src/texk/web2c/mpdir/lib/mp.w | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/texk/web2c/mpdir/lib/mp.w b/src/texk/web2c/mpdir/lib/mp.w index 7fabf9a..3ae94b5 100644 --- a/src/texk/web2c/mpdir/lib/mp.w +++ b/src/texk/web2c/mpdir/lib/mp.w @@ -10922,6 +10922,9 @@ the path should always change the sign of |turn_amt|. printf("dsign <- (%d, %d, %d, %d)\n", dx, dyin, dxin, dy); d_sign=mp_ab_vs_cd(mp, dx,dyin, dxin,dy); printf("dsign : %d\n", d_sign); +if ( d_sign==0 ) { + @ +} if ( d_sign==0 ) { if ( dx==0 ) { if ( dy>0 ) d_sign=1; else d_sign=-1; @@ -10935,6 +10938,17 @@ printf("dsign -> %d\n", d_sign); turn_amt=mp_get_turn_amt(mp, w, dxin, dyin, (d_sign>0)); if ( ss<0 ) turn_amt=turn_amt-d_sign*n +@ We check rotation direction by looking at the vector connecting the current +node with the next. If its angle with incoming and outgoing tangents has the +same sign, we pick this as |d_sign|, since it means we have a flex, not a cusp. +Otherwise we proceed to the cusp code. + +@= +u0=x_coord(q)-x_coord(p); +u1=y_coord(q)-y_coord(p); +d_sign = half(mp_ab_vs_cd(mp, dx, u1, u0, dy)+ + mp_ab_vs_cd(mp, u0, dyin, dxin, u1)); + @ In order to be invariant under path reversal, the result of this computation should not change when |x0|, |y0|, $\ldots$ are all negated and |(x0,y0)| is then swapped with |(x2,y2)|. We make use of the identities -- 2.32.0.93.g670b81a890