Hi Steve!

I am working on a pet project where I want to draw diagrams consisting of
> connected circular arcs.
>

I presume you mean sector-of-circle arcs, quite possibly semi-circle arcs,
as opposed to full circles?
Are you opposed to ellipses, splines, and railroad "spiral" that is doubly
differentiable where it butt-joints to a straight?

  I think it could be done in Visio,
> but I no longer have that.
>

Possibly my favorite MS Office component.
The standard answer to "like Visio but FLOSS" is LibreOffice Draw.
Other alternatives see https://alternativeto.net/software/microsoft-visio/

My preferred programming language is Perl.
>
But I have not actively used it for many years.
>
Tsk. Get back at it :-D

My current PC runs Windows 10, but I could also use Windows 11 for
> development.


Well I'd say it's half-past time you set up for a Linux dual-boot.
Windows 11 looks to be a little too strange.

This is perl 5, version 28, subversion 2 (v5.28.2) built for
>

Since we're up to Perl 5.040 with 5.041 in final development, yeah you
might just want to update Perl.
Good news IIRC is they've resumed prebuilt binaries.

I think the GD library could do this, and there are some Perl APIs to it.
>

Yes, GD <https://metacpan.org/pod/GD#Drawing-Commands> and GD::Simple on
CPAN can draw circular and elliptical arcs (and if filled, sectors).
(I used the filled elliptical arc sectors in GD.pm to recreate and then
refine my ca.1990 MSC EGA color solid (Wang Labs tower 1).)

But the library itself seems old and maybe difficult to install on Windows.
>

GD libraries haven't been a problem for me on Linux at least.
I reload GD.pm etc annually when I perlbrew the new release of Perl and
reload my libs.
I haven't built GD.pm on Windows in so long I can't personally advise.
CPANTS <http://matrix.cpantesters.org/?dist=GD%202.83;maxver=1> shows 1
success each on MSWIN32 with Perl 5.40.[01], 5.38.2, 5.36.3, 5.32.1 and GD
2.83.
It failed once with dev Perl builds 5.41.[567], but that's not alarming;
they've reverted a couple less-backwards-compatible-than-expected changes
in dev.
(I notice that GD has had an ongoing problem with OpenBSD and Solaris,
WTAF?)

What do people suggest?
>

For many graph-diagrams, the sensible approach is for a Perl program to
emit a textual form of the graph, e.g. GraphViz dot language files, which
get turned into SVG and/or PNG by GraphViz commandline tool (usually called
'dot' after the default "Engine"*).
https://metacpan.org/pod/GraphViz2
https://graphviz.org/docs/layouts/dot/
*(Hint: in GV, different built-in layout rules are called "Engines".)

Setting the default edge type in a GraphViz graph to *splines=curved* will
give *not* circular but *spline* curves.
Example
<https://edotor.net/?engine=dot#%23%20Place%20the%20cursor%20inside%20%22graph%22%20to%20get%20some%20refactoring%20options%0A%0Agraph%20%7B%0A%0A%09splines%3Dcurved%3B%20%0A%09%0A%20%20%20%20%23%20To%20refactor%20nodes%2C%20place%20the%20cursor%20left%20to%20a%20node%20name%0A%20%20%20%20a%20--%20b%0A%20%20%20%20a%20--%20c%3B%0A%20%20%20%20a%20--%20d%3B%0A%0A%20%20%20%20%23%20Hover%20over%20color%20names%20to%20get%20a%20color%20picker%0A%20%20%20%20b%20--%20b%20%5Bcolor%3Dblue%5D%0A%20%20%20%20b%20--%20d%20%5Bcolor%3D%22%23ff0000%22%5D%3B%0A%0A%20%20%20%20%23%20Get%20completion%20when%20assigning%20a%20shape%20or%20color%0A%20%20%20%20b%20%5Bshape%3Dbox%2C%20color%3Dyellow%5D%3B%0A%0A%20%20%20%20a%3B%20%23%20You%20can%20remove%20optional%20%3B%20by%20placing%20the%20cursor%20left%20to%20a%20semicolon%0A%7D%0A>.
(online GV dot editor/tutorial/example !! neat!)
AFAIK, GraphViz doesn't have semicircles as an option? But it does like
drawing full 360° circles.

For now I just want to draw the diagrams.  But later I might also want to
> count the number of edges, vertices, and faces.  That is why I am
> considering using a program.
>

A good reason for using a declarative text format of the diagram as an
intermediary, such as GraphViz's dot language.

One last point.  This could be a good first test (for me) of AI code assist
> tools.  But I think they usually generate Python or Javascript, and I have
> not used either of those languages.  Are there AI tools that generate
> Perl?
>

a) I find that thought unclean.
b) the common LLM hallucinatory-oracles apparently create fairly good Perl
since we've put so much of it online for them to violate copyrights of. (As
in, if it gives you code I wrote as "Same License as Perl" and doesn't tell
you that, it's theft.) Ovid (Curtis) has been blogging about using them.
He's a good enough coder he can fix whatever errors the LLM hallucinates,
so it may save him time and not create more technical debt due to hidden
bugs but ...

// Bill

_______________________________________________
Boston-pm mailing list
[email protected]
https://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to