diagrams / diagrams-contrib

User-contributed extensions to diagrams
BSD 3-Clause "New" or "Revised" License
27 stars 30 forks source link

MetaFont: symmetric points result in non-symmetric spline #87

Open sheaf opened 2 years ago

sheaf commented 2 years ago

Consider the following path:

curve_trail = metafont path
  where
    z5 = p2 ( 10  , -12   )
    z6 = p2 (  7.5,  -7.5 )
    z7 = p2 (  4  ,  -7.5 )
    z8 = p2 (  7.5,  -7.5 )
    z9 = p2 ( 10  ,  -3   )
    path =
       z5 .--.
       z6 .- up -.
       z7 .--.
       z8 .--.
       endpt z9
    up = arriving $ V2 0 (-1)

it is vertically symmetric around z7. The MetaFont executable produces the following output:

MetaFont_beta_test

However, with this library, I get a lopsided result:

MetaFont_beta_test_diagrams

I know this library isn't aiming to replicate the exact MetaFont algorithm (that's of course fine), but I think it's producing an incorrect result here.

byorgey commented 2 years ago

Thanks for the report! I agree that is a strange result. It has been a very long time since I touched this code but maybe I can take a look. @bergey , are you still around? I'm not assuming you remember anything about this code either, but you're the one who originally wrote it. =)