Luxor

After adding the Luxor package to the Julia installation we try it out using the following code.


                using Luxor

                @png begin
                    text("Hello world")
                    circle(Point(0, 0), 200, :stroke)
                end
            

The output, even in the repl, is this image:

Euclidean Eggs

The following comes from a tutorial on using Luxor. The tutorial is here: Luxor Tutorial


                @png begin
                    radius=80
                    setdash("dot")
                    sethue("gray30")
                    A, B = [Point(x, 0) for x in [-radius, radius]]
                    line(A, B, :stroke)
                    circle(O, radius, :stroke)
                    label("A", :NW, A)
                    label("O", :N,  O)
                    label("B", :NE, B)
                
                    circle.([A, O, B], 2, :fill)
                    circle.([A, B], 2radius, :stroke)
                    nints, C, D =
                    intersectionlinecircle(Point(0, -2radius), Point(0, 2radius), A, 2radius)
            
                    if nints == 2
                        circle.([C, D], 2, :fill)
                        label.(["D", "C"], :N, [D, C])
                    end

                    nints, C1, C2 = intersectionlinecircle(O, D, O, radius)
                    if nints == 2
                        circle(C1, 3, :fill)
                        label("C1", :N, C1)
                    end

                    nints, C1, C2 = intersectionlinecircle(O, D, O, radius)
                    if nints == 2
                        circle(C1, 3, :fill)
                        label("C1", :N, C1)
                    end
                
                    nints, I3, I4 = intersectionlinecircle(A, C1, A, 2radius)
                    nints, I1, I2 = intersectionlinecircle(B, C1, B, 2radius)
                
                    circle.([I1, I2, I3, I4], 2, :fill)


                    if distance(C1, I1) < distance(C1, I2)
                        ip1 = I1
                    else
                        ip1 = I2
                    end

                    if distance(C1, I3) < distance(C1, I4)
                        ip2 = I3
                    else
                        ip2 = I4
                    end

                    label("ip1", :N, ip1)
                    label("ip2", :N, ip2)
                    circle(C1, distance(C1, ip1), :stroke)

                    setline(5)
                    setdash("solid")
                
                    arc2r(B,    A,  ip1, :path) # centered at B, from A to ip1
                    arc2r(C1, ip1,  ip2, :path)
                    arc2r(A,  ip2,    B, :path)
                    arc2r(O,    B,    A, :path)

                    strokepreserve()
                    setopacity(0.8)
                    sethue("ivory")
                    fillpath()                    

                end