*Penrose:*

from mathematical notation to beautiful diagrams

by Katherine Ye^{1}, Wode Ni^{1}, Max Krieger^{1}, Dor Ma'ayan^{1, 2}, Jenna Wise^{1}, Jonathan Aldrich^{1}, Joshua Sunshine^{1}, and Keenan Crane^{1}

^{1}Carnegie Mellon University, ^{2}Technion

appearing in SIGGRAPH 2020

## Paper

## Video

## Abstract

We introduce a system called *Penrose* for creating mathematical diagrams. Its basic functionality is to translate abstract statements written in familiar math-like notation into one or more possible visual representations. Rather than rely on a fixed library of visualization tools, the visual representation is user-defined in a constraint-based specification language; diagrams are then generated automatically via constrained numerical optimization. The system is user-extensible to many domains of mathematics, and is fast enough for iterative design exploration. In contrast to tools that specify diagrams via direct manipulation or low-level graphics programming, *Penrose* enables rapid creation and exploration of diagrams that faithfully preserve the underlying mathematical meaning. We demonstrate the effectiveness and generality of the system by showing how it can be used to illustrate a diverse set of concepts from mathematics and computer graphics.

## Want to use *Penrose* or collaborate?

Please note that *Penrose* is an early-stage system that is still in development. Our system is not ready for contributions or public use yet, but we're working on it!

Want to be the first to hear about our system as we build it? Join our mailing list:

And reach out to us on Twitter: @hypotext, @wodenimoni, @maxkriegers, @dorma10, @wise_jenna, @JAldrichCMU, @joshsunshine, and @keenanisalive.

We're especially looking to talk with authors, educators, and expert illustrators who might be interested in collaborating on building a *Penrose* library for their area of expertise. Please fill out the form below (also accessible here) if interested.

## Selected figures

**Point** p, q, r, s

**Segment** a := {p, q}

**Segment** b := {p, r}

**Point** m := **Midpoint**(a)

**Angle** theta := ∠(q, p, r)

**Triangle** t := {p, r, s}

**Ray** w := **Bisector**(theta)

**Ray** h := **PerpendicularBisector**(a)

**PathType** t

**HasForm**(t,"L(D|S)S*E")

**Path** p := **Sample**(t)

For any vector space *X*, let *u, v ∈ X* be orthogonal vectors of equal length, and let *w = u + v*. Then *u* and *w* make a 45◦ angle.

**VectorSpace** X

**Vector** u, v ∈ X

**Orthogonal**(u, v)

**EqualLength**(u, v)

**Vector** w ∈ X

w := u + v

-- Sets.dsl

**type** Set

**predicate** Intersecting : Set s1 * Set s2

**predicate** IsSubset : Set s1 * Set s2

**predicate** Not : Prop p

**notation** "A ⊂ B" ~ "IsSubset(A, B)"

**notation** "A ∩ B = ∅" ~ "Not(Intersecting(A, B))"

-- Sets.sub

**Set** A, B, C, D, E, F, G

B ⊂ A

C ⊂ A

D ⊂ B

E ⊂ B

F ⊂ C

G ⊂ C

E ∩ D = ∅

F ∩ G = ∅

B ∩ C = ∅

-- Sets-Disks.sty

**forall** Set x {

x.text = Text { string : x.label }

**ensure**contains(x.shape, x.text)

**encourage**sameCenter(x.text, x.shape)

**layer**x.shape

**below**x.text

}

**forall** Set x; Set y

**where** IsSubset(x, y) {

**ensure**contains(y.shape, x.shape)

**ensure**smallerThan(x.shape, y.shape)

**ensure**outsideOf(y.text, x.shape)

**layer**x.shape

**above**y.shape

**layer**y.text

**below**x.shape

}

**forall** Set x; Set y

**where** NotIntersecting(x, y) {

**ensure**disjoint(x.shape, y.shape)

}

-- Injection.sub

**Set** A, B

f: A -> B

**Injection**(f)

**Not**(**Surjection**(f))

-- Surjection.sub

**Set** A, B

f: A -> B

**Surjection**(f)

**Not**(**Injection**(f))

-- Bijection.sub

**Set** A, B

f: A -> B

**Surjection**(f)

**Injection**(f)

**SimplicialComplex** K

**Edge** e ∈ K

**Subcomplex** E ⊆ K

E := **Closure**(e)

**SimplicialSet** StE ⊆ K

StE := Star(E)

**Subcomplex** ClStE ⊆ K

ClStE := **Closure**(StE)

**Subcomplex** ClE ⊆ K

ClE := **Closure**(E)

**SimplicialSet** StClE ⊆ K

StClE := **Star**(ClE)

**SimplicialSet** LkE ⊆ K

LkE := **SetMinus**(ClStE, StClE)

## More information

Coming in July: SIGGRAPH '20 talk video and slides

Check out our CHI paper on natural diagramming!

## Acknowledgments

We thank Lily Shellhammer and Yumeng Du for their help. The first author was supported by a Microsoft Research PhD Fellowship and ARCS Foundation Fellowship while completing this work; the last author was supported by a Packard Fellowship. This material is based upon work supported by the National Science Foundation under grants DMS-1439786 and CCF-1910264, the AFRL and DARPA under agreement FA8750-16-2-0042, and the Alfred P. Sloan Foundation under award G-2019-11406.

## How to cite

**ACM reference format**

Katherine Ye, Wode Ni, Max Krieger, Dor Ma’ayan, Jenna Wise, Jonathan Aldrich, Joshua Sunshine, and Keenan Crane. 2020. Penrose: From Mathematical Notation to Beautiful Diagrams. *ACM Trans. Graph.* 39, 4, Article 144 (July 2020), 16 pages. https://doi.org/10.1145/3386569.3392375

**BibTeX**

title = {Penrose: From Mathematical Notation to Beautiful Diagrams},

journal = {ACM Trans. Graph.},

volume = {39},

number = {4},

year = {2020},

publisher = {ACM},

address = {New York, NY, USA}

**Project link**