TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Various Things in MetaPost

80 pointsby mcialmost 6 years ago

5 comments

svatalmost 6 years ago
This is a nice use of MetaPost and the figures look elegant! The shading and textures seems to be a Russian aesthetic, as it reminds me of Irodov and other Mir Publishers books from my childhood in India.<p>For those who may not know much about MetaPost, it was originally written by Donald Knuth&#x27;s student John Hobby, to a great extent based (both syntax and code of the program itself) on METAFONT, written by Knuth for designing fonts, as the companion to TeX. The idea is to describe shapes—either shapes of letters (glyphs in the typeface) in case of METAFONT, or other shapes in case of MetaPost—by telling the computer how to draw them, i.e. writing a program that describes the shape. The program automatically computes intersections of lines, joins points using “most pleasing curves” (Hobby splines), etc. See for example Figure 6 in this post whose code is simply<p><pre><code> beginfig(6); draw sphere.c(1.2cm); draw sphere.c(2.4cm) shifted (2cm, 0); endfig; </code></pre> after the author has defined the sphere.c function (macro) with shading and shadows etc (<a href="https:&#x2F;&#x2F;github.com&#x2F;jemmybutton&#x2F;fiziko&#x2F;blob&#x2F;2ccb6e1&#x2F;fiziko.mp#L692-L723" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jemmybutton&#x2F;fiziko&#x2F;blob&#x2F;2ccb6e1&#x2F;fiziko.mp...</a>).<p>It&#x27;s really a fantastic way to draw for certain people, but it requires you to think about the shape to a greater level of detail (enough to write a program basically) than simply drawing it, so it&#x27;s not for everyone. The syntax of other similar programs like TikZ and Asymptote has also been greatly influenced by that of METAFONT&#x2F;MetaPost.<p>BTW the author of this post here (jemmybutton &#x2F; Sergey Slyusarev) is also the author of [Fancy Euclid&#x27;s “Elements” in TeX] that was posted here a while ago: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20019616" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20019616</a>
triskaalmost 6 years ago
Wow, these are beautiful graphs and programs!<p>Thank you for putting this together, and for sharing it!
评论 #20374955 未加载
nightcrackeralmost 6 years ago
I&#x27;m wondering if you could generate pictures in that style using signed distance fields as your primitives.
评论 #20377104 未加载
Athasalmost 6 years ago
These pictures are wonderful. Far better than the soulless CGI renderings found in most textbooks!
dmixalmost 6 years ago
This would be great combined with one of those visual programming tools.