3 ms·
Cassowary is an incremental solver for linear systems of equations and inequalities, while Basalt's constraints are more expressive (which is why it needs an SM
by anishathalye 7y ago
Cassowary is an incremental solver for linear systems of equations and inequalities, while Basalt's constraints are more expressive (which is why it needs an SMT solver). One example of something that's not expressible in a linear system is computing bounds of a group of objects, which has been a common pattern in my Basalt figure, e.g. to position a group of objects next to another. The Group element in Basalt computes its bounds by computing min/max of its elements' bounds, but Cassowary constraints can't contain min/max.
- Jyaif 7y agoI'm pretty sure you can implement min/max with a Cassowary-style constraint solver using multiple constraints with priorities. For example to get the max between v0 and v1 you can use those 3 constraints: [v0 > limit @ priority1, v1 > limit @ priority1, limit == -infinity @ priority0] |limit| contains the max, which you can use in other constraints.