Open GregDavidson opened 2 years ago
You might be interested in this blogpost about Basalt. At the end there is mention of an in-progress Racket DSL, but as far as I know that hasn't been developed. There are some existing solver tools in Racket like Rosette and CSP. A specialized solver, like Cassowary (also by Alan Borning), might be more effective than these solvers though. A Cassowary port for Racket would be a nice contribution! Typed Racket might be a good way to go since these kind of numeric programs can benefit a good deal from TR's optimizations.
Metapict [1] is inspired by MetaPost (and MetaFont) [2] and TikZ.
In MetaPost it is possible to declare a relationship between two or more variables with a set of linear equations. When a variable reference is made to a variable that is part of such a set, the equations are solved and the result is used as the value for the variable.
There are nice introductions to equations in MetaPost here [3], [4] and [5].
Having a general way of "specify (linear) relations between variables" that could be used as a "plugin" in Metapict and elsewhere would be great.
If I remember correctly, the implementation ran Gauss elimination when there is an variable reference. The result is cached - and reused if there are more variable references or more equation declarations later.
Btw - should be move this discussion to https://racket.discourse.group/ instead?
[1] https://docs.racket-lang.org/metapict/index.html [2] https://tug.org/metapost.html [3] https://tug.org/texlive/Contents/live/texmf-dist/doc/metapost/base/mpman.pdf (Chapter 5) [4] https://tug.org/TUGboat/tb30-2/tb95hoeppner.pdf [5] https://learnmetapost.onrender.com/learn-metapost/equations/
I love Functional Graphics and
pict
! I would love to combinepict
with a constraint-based sizing and layout engine. Has there been any exploration of this? I would like to build something like Alan Borning's ThingLab which was inspired by Ivan Sutherland's Sketchpad. I'm imagining that doing it elegantly would require being able to provide an external environment (computed by the constraint engine) at render time which would override individual size and position information in the tree ofpict
, but perhaps there are other ways of doing it.