It turns out graphviz works a lot better for "lay stuff out in a shape" when I switch the engine to "neato". I'm having trouble getting the lengths to fully work in all of the cases I want to cover, but I can fake it by throwing some random mathematical operations at it.
I'm going to step back from trying to get the shapes "exactly right", and consider what I need to add to get the rendering right.
What I'm basically doing here is creating a polygon, where the graphviz nodes correspond to the vertices, and to the midpoints of the edges. (And some other nodes that just exist to try to control the layout.) In my proof-of-concept code, they just have generated names/labels, but want to be dropping in nodes with custom labels that may end up pulling in other nodes connected to them.
Okay, as I think about that, I think I might want to try harder to express the positions of this stuff in absolute terms, and with the aid of piles of trig...
As I see it, the problem of layout boils down to:
- Determine the convex hull of each component
- Generate a set of points based on the required graph structure
- Generate the Voronoi diagram of the point set
- Place the anchor point of each component on its corresponding point, and scale the distances between points until the convex hull is entirely within the corresponding region of the Voronoi diagram
All right, I think this, like, should work, but I've put enough effort into this that I'm now willing to try simpler solutions that don't have as much pizzazz.
Okay, I started working on that, and I need to put in more effort, but I'll be fine with a barebones representation for now.
It's getting late,so I'll get back to writing tomorrow.