[plt-scheme] MrLib/graph.ss edges as splines

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Dec 12 12:30:12 EST 2007

Cute. :)

But I think there'd still be more work to do, since the splines don't
line up with the arrow heads all the time.

Robby

On Dec 12, 2007 11:02 AM, Stephen De Gabrielle <stephen at degabrielle.name> wrote:
> Hi,
> Like a dill I only recently realised that MrEd had a spline draw feature.
>
> Just a fun here is a little mod of graph.ss that gives curved arrows.
>
> [It looks best for horizontal graphs...]
>
> ;line 593 comment out draw-line
> ;                           (send dc draw-line
> ;                                (+ dx from-x) (+ dy from-y) ; start
> ;                                (+ dx to-x) (+ dy to-y)); end
> ;include draw-spline
>                            (let* (
>                                   (x1 (+ dx from-x)) ; start-point
>                                   (y1 (+ dy from-y))
>                                   (x2 (+ dx to-x))     ; end-point
>                                   (y2 (+ dy to-y))
>                                   (xmid (/ (+ x1 x2) 2)) ; mid-point for
> nice curve
>                                   (ymid (/ (+ y1 y2) 2))
>
>                                   (x3 (+  (/ x1 4) (/ (* 3 xmid) 4))) ;
> control point
>                                   (y3 (+  (/ (* 3 y1) 4) (/ ymid 4)))
>
>                                   (x4 (+  (/ (* 3 xmid) 4) (/ x2 4))) ;
> control point.
>                                   (y4 (+  (/ ymid 4) (/ (* 3 y2) 4)))
>
>                                   )
>                              (send dc draw-spline  ;  first bit
>                                    x1 y1
>                                    x3 y3 ;  control point.
>                                    xmid ymid)
>                              (send dc draw-spline  ;  second bit
>                                    xmid ymid
>                                    x4 y4
>                                    x2 y2)
>                              )
>
>
> Cheers,
>
> Stephen
>
>
>
> --
> Stephen De Gabrielle
> s.degabrielle at ucl.ac.uk
> Telephone +44 (0)20 7679 5242 (x45242)
> Mobile                  079 851 890 45
> http://www.uclic.ucl.ac.uk/annb/MaSI.html
> University College London Interaction Centre
> Remax House - 31/32 Alfred Place
> London - WC1E 7DP
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>


Posted on the users mailing list.