Updated MetaPict today in order to fix missing exports from node.rkt.
The following example now produces this picture:
https://imgur.com/a/AYTz7
The parameters to control the shape of the arrow is explained here:
http://www.ntg.nl/maps/36/19.pdf
but the default arrow looks fine.
#lang racket
(require metapict)
(set-curve-pict-size 400 400) ; pict size
(curve-pict-window (window -1 3 -1 3)) ; x in [-1;3] and y in [-1;3]
; ah means "arrow head"
(ahangle 45) ; default head angle 45 degrees
(ahflankangle 0) ; default "curvature" of flank (in degrees)
(ahtailcurvature 0) ; default "curvature" of the back todo!
(ahratio 1)
(ahlength (px 6))
; node centers
(define c1 (pt 0 0))
(define c2 (pt 2 0))
(define c3 (pt 0 2))
(define c4 (pt 2 2))
; nodes
(define n1 (circle-node c1 .3))
(define n2 (circle-node c2 .3))
(define n3 (square-node c3 .3))
(define n4 (circle-node c4 .3))
(define (outside n1 v s)
(define a (anchor n1 v))
(define n (normal n1 v))
(pt+ a (vec* s n)))
(define (besides p dir s)
; point next to p in the direction dir,
; the parameter s determines how far
(pt+ p (vec* s dir)))
(define (between p1 p2)
(med 1/2 c1 p2)) ; midpoint
(margin 5
(draw n1 n2 n3 (filled-node n4) ; the nodes
(label-bot "AB" (outside n1 down 0.05)) ; label below node n1
(label-cnt "42" c1) ; contents (42) in
the center of node 1
(draw-edge n1 n2) ; edge from node n1
to node n2
(draw-edge n1 n3 west south) ; edge from west
side of n1 to south side of n3
(draw-edge n1 n4) ; edge from node n1
to node n4
; ; label right of
midpoint of nodes 1 and 4
(label-rt "transition"
(besides (between c1 c4) east 0.1))))
2017-08-19 16:19 GMT+02:00 Jens Axel Søgaard <[email protected]>:
> 2017-08-18 12:10 GMT+02:00 Andrew Gwozdziewycz <[email protected]>:
>
>> Hi folks,
>>
>> I've been using graphviz for years for basic network architecture
>> diagrams and things, mostly to avoid answering the question of "which
>> annoying tool should I use?" Graphviz has limitations for the type of
>> stuff I use it for, but I settle for it anyway, since it's a lot less
>> frustrating to use a language for laying out relationships than
>> clicking and dragging lines connecting things, in an agreed upon
>> diagramming tool.
>>
>> Has anyone started work (or finished work, or even somewhere in
>> between?) on a diagramming language that might be, or even eventually
>> will be a suitable replacement for performing these types of tasks?
>>
>> And if not, does anyone have suggestions for getting started with
>> layout drawing algorithms suitable for such a thing? I'm fairly sure
>> that the pict language will do the heavy lifting work for actually
>> drawing on a canvas, and simple layout techniques probably would go
>> along way, but getting to know the field a bit might be useful...
>>
>
> Maybe you can find something useful in MetaPict?
>
> http://soegaard.github.io/docs/metapict/metapict.html
>
> As for algorithms, this module contains references to interesting tree
> drawing algorithms:
>
> https://github.com/soegaard/metapict/blob/master/metapict/tree.rkt
>
>
> /Jens Axel
>
>
--
--
Jens Axel Søgaard
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.