找回密码
 快速注册
搜索
查看: 33|回复: 0

Penrose - 通过纯文本键入数学符号来创建图表

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2023-4-3 10:59 |阅读模式
penrose.cs.cmu.edu/
一个集合论的例子:

它由以下 Domain, Substance, Style programs 指定
setTheory.domain:
  1. type Set
  2. predicate Not(Prop p1)
  3. predicate Intersecting(Set s1, Set s2)
  4. predicate IsSubset(Set s1, Set s2)
复制代码

tree.substance:
  1. Set A, B, C, D, E, F, G
  2. IsSubset(B, A)
  3. IsSubset(C, A)
  4. IsSubset(D, B)
  5. IsSubset(E, B)
  6. IsSubset(F, C)
  7. IsSubset(G, C)
  8. Not(Intersecting(E, D))
  9. Not(Intersecting(F, G))
  10. Not(Intersecting(B, C))
  11. AutoLabel All
复制代码

venn.style:
  1. canvas {
  2.   width = 800
  3.   height = 700
  4. }
  5. forall Set x {
  6.   x.icon = Circle {
  7.     strokeWidth : 0
  8.   }
  9.   x.text = Equation {
  10.     string : x.label
  11.     fontSize : "25px"
  12.   }
  13.   ensure contains(x.icon, x.text)
  14.   encourage sameCenter(x.text, x.icon)
  15.   x.textLayering = x.text above x.icon
  16. }
  17. forall Set x; Set y
  18. where IsSubset(x, y) {
  19.   ensure smallerThan(x.icon, y.icon)
  20.   ensure disjoint(y.text, x.icon, 10)
  21.   ensure contains(y.icon, x.icon, 5)
  22.   x.icon above y.icon
  23. }
  24. forall Set x; Set y
  25. where Not(Intersecting(x, y)) {
  26.   ensure disjoint(x.icon, y.icon)
  27. }
  28. forall Set x; Set y
  29. where Intersecting(x, y) {
  30.   ensure overlapping(x.icon, y.icon)
  31.   ensure disjoint(y.text, x.icon)
  32.   ensure disjoint(x.text, y.icon)
  33. }
复制代码

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:56

Powered by Discuz!

× 快速回复 返回顶部 返回列表