exgraph-example: a trio from https://penrose.ink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Graph | |
predicate not : Graph g1 | |
predicate and : Graph g1 * Graph g2 | |
predicate or : Graph g1 * Graph g2 | |
predicate if : Graph g1 * Graph g2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Graph a { | |
a.shape = Circle { | |
strokeWidth: 0 | |
} | |
a.text = Text { | |
string: a.label | |
} | |
ensure minSize(a.shape) | |
ensure maxSize(a.shape) | |
encourage sameCenter(a.text, a.shape) | |
} | |
Graph a; Graph b | |
where or(a, b) { | |
-- make a shape for outer circle | |
orShape = Circle { | |
center: (0, 0) | |
} | |
-- a’s shape is in it | |
ensure contains(orShape, a.shape) | |
-- b’s shape is in it | |
ensure contains(orShape, b.shape) | |
-- size functions | |
ensure minSize(orShape) | |
ensure maxSize(orShape) | |
-- a’s shape and b’s shape don’t overlap | |
ensure disjoint(a.shape, b.shape) | |
-- a’s shape and b’s shape are the same size? are they aligned? etc. | |
override a.shape.r = b.shape.r | |
override a.shape.color = b.shape.color | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Graph p, q | |
or(p, q) | |
AutoLabel All |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"authorship":{"madeBy":"maxkrieger","name":"exgraph-example","avatar":"https://avatars.githubusercontent.com/u/2660634?v=4"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment