Would be nice to have a site, maybe a wiki, dedicated to this kind of thing.
Other interesting problems in this area:
* Layout algorithms
* Automatic assignment of keys for navigation (for nav w/o using a mouse)
* Popup menu prediction [1]
* Text breaking / paragraph layout [2]
* Etc, etc, etc ...
1: https://bjk5.com/post/44698559168/breaking-down-amazons-mega...
- Facebook (that I designed): https://blog.vjeux.com/2012/image/image-layout-algorithm-fac...
- Google Plus: https://blog.vjeux.com/2012/javascript/image-layout-algorith...
- Google Plus, finding best breaks, which also explains fancy text layout algorithm: https://blog.vjeux.com/2014/image/google-plus-layout-find-be...
- Lightbox: https://blog.vjeux.com/2012/javascript/image-layout-algorith...
- Lightbox Android: https://blog.vjeux.com/2012/javascript/image-layout-algorith...
- 500px: https://blog.vjeux.com/2012/javascript/image-layout-algorith...
I hope that’s useful!
In particular, I'm incredibly interested in layout algorithms - I'm working on building a GUI toolkit, for which I need layout algorithms to lay out widgets, but can't find anything other than descriptions of how to use existing systems...
I don't know if modern typesetting software like InDesign do solve this automatically or not. The web certainly don't (although with CSS and the "shy" Unicode char you at least get some control on the 'H' part of "H & J"). Back in my typesetting days QuarkXPress had nothing to help with rivers: you had to detect them visually and then "fudge" the paragraph a bit (by forcing a line-break or an hyphenation).
I always wondered: certainly if you start with a good H & J algorithm, it must be possible to try a few candidates and determine, programatically, which one has the least obvious rivers? Fascinating stuff IMHO.
P.S: I also wonder if it's because algorithms for layout out paragraphs are so bad on the web that justification is typically frowned upon on the Web? (it certainly rules king in printed books)
Unfortunately, I don't have a good writeup of that, but some of the details are in this ATypI talk[1].
I recall I did a Mac XPress XTension that used GUSI (sockets) to talk to a 4D server to grab artwork. I even had it multi-threading (co-operative of course) and a UI using PowerPlant. Rather a hack.
E.g. if we could start an arrow in the middle of the small protruding "ledge" of the bottom box, we could do this:
,-------.
: :
: v
: +----------------+
: | |
+----------------+ |
| |--+
| |
+----------------+
It's not written in stone that box-and-arrow diagrams must be connected by edge midpoints. That can't even work well any time you have multiple arrows emanating or terminating on the same edge.Very good first iteration round, though.
Another one would be reducing the amount of crossover between different arrows.
I was chastened by the complexity of just drawing the lines between boxes so that they didn't overlap (as much as possible) and were drawn on facing sides (one of the later problems discussed in the article). I don't recall how I did it, but I do remember a sudden refresher on matrix multiplication.
It drove home how simple things can be more complicated than you might expect.
EDIT: also, I appreciated the way the article was written. No cruft.
Nowadays when I have new work that has a lot of unknowns, I try to jump in and create a proof of concept as quickly as I can, even if it requires a ton of hacks. I want to know right off the bat if there's something obvious that's going to make the task take much longer than I wanted.
`dot -T ${format} -n${n} ${verbose>1?"-v ":""}-Goverlap-true -Gsplines=false -Kneato -o "${ output }" "${ input }"`
this still doesn't do subgraphs well,
so I sometime do the 'groups' in a separate document, then composite the layers with image magick
`magick composite ${verbose>1?"-verbose ":""}-gravity NorthWest "${a}" "${b}" "${png_output}"`;
[0] https://www.eclipse.org/elk
He took a flimsy pvc pipe, nailed it down at the beginning and end of the curve, and it bent into a perfect S curve that he then spray painted down to follow.
It’s amazing how physics and nature can solve these problems for you!
But of course, I have Opinions that would keep me from using this in practice. For example, my favorite style is similar to a half curly-bracket (or, taste depending, an integral symbol) -- two small semicircles connected by an axis-aligned line.
Edit: oh, and question from the peanut gallery... what if one box is fully within the other, and centered?
Good. Then fork the library and modify it to your liking, optionally republish.
>one box is fully within the other, and centered
This implies containment/stacking and wouldn't require an arrow. However, you could do worse than drawing 4 arrows from the edges of the surrounding rectangle.
To get around it, I switched the line drawing function for IE11 so that it would draw two divs that would extend from the middle of each box and touch corners in the middle (basically figure 4 in the article), then style them with a curved border on the appropriate side. While not as elegant as what's shown here, it was convincing enough that nobody noticed any visual difference between it and the regular version.
I've actually taken up hand-drawing diagrams lately and it's worked well. I get a lot of comments at work - "haha wow nice art!" (sarcasm) followed by "actually this is really easy to follow". I feel like it's both faster to draw and a more accurate representation of my mental model when I draw by hand.
But hey, if the diagramming tools were smart like in this post, maybe I'd go back to the tools for awhile ;)
Here's a specific example: https://imgur.com/a/1n2JiB3
In the final analysis, one should strive to get a visually balanced look, which takes into account placement, thickness of lines, density of information etc. There is no one-size fits all.
Because they are eaiser to stack without getting garbled!
didn't gather a lot of discussion though...
This is an odd assumption to make.
https://en.wikipedia.org/wiki/Force-directed_graph_drawing#/...
https://github.com/mathew-j-davis/boxesandarrows
I've been setting the 'waypoints' for more complex curves (curves with many bends) manually (typing the bezier numbers in by hand), while I try and figure out how I want them routed, you're right it's not easy figuring out rules for where edge should go, let alone implementing it
So for example, if the user is responsible for organizing the boxes and there is also a way to create custom arrows, this library can be used to suggest arrows, which might be good 95% of the time. That would be better than many of the tools I have used over the years.
However, if you want to generate a final diagram and can't guarantee, that the order of boxes doesn't allow for overlapping connections, this library is probably the wrong choice.