TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Experiments in Constraint-based Graphic Design (2019)

62 点作者 losfair超过 3 年前

6 条评论

dragontamer超过 3 年前
Hmmmm... I can&#x27;t help but feel like this technique is related to the TeX layout engine.<p>If you&#x27;ve ever read Knuth&#x27;s TeX design, you&#x27;ll know that TeX has a intricate solver to determine the &quot;badness&quot; of lines. The spaces between words (and sentences: such as the &quot;.&quot;) will be manipulated to minimize the &quot;rivers&quot; of poor-justification algorithms.<p>Today, instead of manually writing a constraint-solver like Knuth did for TeX in the 1980s, it makes sense to leverage open-source solvers like Z3.<p>-----------<p>We can see that TeX is simply a domain-specific language that puts glyphs (in the form of letters) into a set of constraints... constraints of the form &quot;width = target_size +&#x2F;- adjustable_size&quot;.<p>And TeX is simply a constraint solver that iterates over all possible combinations (!!!) and selects the set of adjustable_sizes for all glyphs for the best looking paragraph (where &quot;best looking&quot; paragraph is a set of calculations Knuth thought looked good back in the 1970s&#x2F;1980s).<p>Knuth proved that TeX&#x27;s solver traverses across an NP complete problem. But it turns out that written paragraphs are &quot;small enough n&quot;, and that exhaustive search (with some good heuristics to speed things up) is possible on computers, even computers 40 years ago.<p>-------<p>I also can&#x27;t help but feel like a lot of UI-design is about layout engines like this. Flexbox makes my head hurt but having the web-browser &quot;solve&quot; constraints that I gave it is more flexible across different devices (phone vs 1080p laptops vs ultrawide desktop screens).<p>Constraints are already used for 3d CAD for engineers (this point must match that point. This angle must be 2&#x2F;3rd of that angle. Etc. etc. Computer, now solve for the shape). Using them as 2D designs for GUIs, figures, and text only makes sense.
评论 #29385706 未加载
dig1超过 3 年前
I find constraint solvers a perfect fit for window managers. For example, take a look at [1] what scwm [2] could do 21 years ago. Sadly (for me) modern window managers (on Linux or Windows) are way inferior to something we had in the past, usually employing something half-baked that often doesn&#x27;t work correctly.<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=SCMUxj2f3Sc" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=SCMUxj2f3Sc</a><p>[2] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scwm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scwm</a>
formatc1702超过 3 年前
As a Mechanical Engineer, I&#x27;m very happy to see designers discovering the joy of parametric CAD :-)<p>I have longed for this sort of functionality in tools like Inkscape, and have often resorted to SolidWorks, Fusion360, SolveSpace, or other engineering-focused tools for &quot;artistic&quot; projects, because they enabled me to quickly iterate over different parameters while respecting certain constraints and relationships (as shown in the original post).. Once I was happy with the result, I would export the design as DXF or similar, and do the final styling in Inkscape.
Jtsummers超过 3 年前
Previous discussion: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=21774018" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=21774018</a> (42 comments)
akdor1154超过 3 年前
At time of previous post, the author was trying to rewrite in racket before releasing the code... did this get anywhere?<p>I have no entitlement at all to see it, but damn i still want to play with this!
danielvaughn超过 3 年前
I&#x27;m currently trying to create a programming language for UI designers, and my approach is very similar to this. Although, the language looks much less like a typical programming language since it&#x27;s not meant for implementing an actual program, just an interface.