Create a new diagram builder.
Local dimensions of the SVG. This has no effect on the rendered size of your diagram--only the size of the local coordinate system.
Randomness seed
Strength of the optimizers lasso term. Higher values encourage diagram continuity, while lower values encourage reactivity. Default is 0.
Create a new input, and constrain that input to a calculated value.
This is useful for reading calculated values from the diagram using getInput,
and for creating draggable values.
Value to bind the input to
Optionalinfo: InputOptsInputOpts for the input
Create a new circle. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/circle
Create a new ellipse. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/ellipse
Register an objective with the diagram.
A Num created with the objectives module (or, if you know what you're doing, by yourself.
You can read about creating custom constaints at https://penrose.cs.cmu.edu/docs/ref/constraints)
Optionalweight: numberAn optional weight to multiply the objective by. If you find that your objectives are not being satisfied, you may want to try increasing the weight.
Register a constraint with the diagram.
A Num created with the constraints module (or, if you know what you're doing, by yourself.
You can read about creating custom constaints at https://penrose.cs.cmu.edu/docs/ref/constraints)
Optionalweight: numberAn optional weight to multiply the constraint by. If you find that your constraints are not being satisfied, you may want to try increasing the weight.
Create a new equation. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/equation
Iterate over all possible assignments of substances to variables. This selection deduplicates assignments.
Iterate over all possible assignments of substances to variables, subject to condition where.
This selection does NOT deduplicate assignments.
Create a new group. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/group
Note that, unlike in Penrose, the clipPath field takes either a Shape or null.
Create a new image. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/image
Create a new input.
Optionalinfo: InputOptsInputOpts for the input
Create a new line. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/line
Create a new path. Options: see https://penrose.cs.cmu.edu/docs/ref/style
Create a new polygon. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/polygon
Create a new polyline. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/polyline
Create a new predicate over substances.
The returned predicate function can be used to declare relationships
between substances (by calling the predicate) and to query existing relation
(by calling the predicate's .test method):
const Vector = type();
const Orthogonal = predicate();
const v1 = Vector();
const v2 = Vector();
Orthogonal.test(v1, v2); // returns false
Orthogonal(v1, v2);
Orthogonal.test(v1, v2); // returns true
Create a new rectangle. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/rectangle
Create an input from a SharedInput.
SharedInput to create an input from
OptionalinitOverride: numberOverride the initial value of the shared input
Create a new text. Options: see https://penrose.cs.cmu.edu/docs/ref/style/shapes/text
Construct a diagram with a Penrose-like API. You may find it useful to destructure an object of this type: