GiovineItalia / Compose.jl

Declarative vector graphics
http://giovineitalia.github.io/Compose.jl/latest/
Other
248 stars 83 forks source link

`introspect` for graphs which are not trees #419

Open danrocag opened 3 years ago

danrocag commented 3 years ago

introspect behaves in a somewhat weird way when given a graph which is not a tree. For example, if we apply it to the Sierpinski fractal from the tutorial:

function sierpinski(n)
    if n == 0
        compose(context(), polygon([(1,1), (0,1), (1/2, 0)]))
    else
        t = sierpinski(n - 1)
        compose(context(),
                (context(1/4,   0, 1/2, 1/2), t),
                (context(  0, 1/2, 1/2, 1/2), t),
                (context(1/2, 1/2, 1/2, 1/2), t))
    end
 #end

introspect(sierpinski(3))

Then the edges are correct, but many irrelevant copies of the vertices are shown. Can this be fixed?