Skip to content

Elements

Elements are the building blocks you declare in Tilde — scalars, points, lines, segments, and triangles.


Scalar

A named value. Scalars can be used anywhere a number is expected — in coordinates, line equations, length constraints, and inline tuples.

scalar m = 2
line a = (m, -1, 0)
line b = (m, -1, -3)    # same slope, different intercept

Scalars can reference other scalars and support forward declarations (use before the scalar statement appears).

point p = (k, 0)
scalar k = 5            # p is placed at (5, 0)

A scalar declared without a value is determined by the solver from geometric constraints.

scalar m
line l = (m, -1, 0)
point a = (0, 0)
point b = (1, 3)
a on l
b on l                  # solver determines m = 3

Point

An explicit point at exact world coordinates.

point p = (3, 5)
click to pan & zoom

Line

An infinite line declared as the implicit equation ax + by + c = 0, or as slope-intercept (m, k) meaning y = mx + k.

line l = (1, 2, -3)    # x + 2y - 3 = 0
line l = (2, 1)         # y = 2x + 1  →  2x - y + 1 = 0

A line can also be declared partially — with one parameter left open. The missing value is filled in by the first placed point that lies on the line. If no such point exists, a canonical default is used.

line l = (2,)           # slope 2, intercept unknown
line l = (, 1)          # y-intercept 1, slope unknown
line l = (1, -1,)       # direction (1, −1) known, position unknown

For slope-intercept form, with slope and with intercept are clearer alternatives. The = is optional — with slope 2 reads the same as with slope=2.

line l with slope 2
line l with intercept 1
line l with slope 2 and intercept 1
line l with slope=2, intercept=1     # = and comma both still work

These can be combined with through:

line l with slope 2 through p        # slope fixed, position determined by p

The bundled form lets a scalar be declared and assigned in the same statement as the line:

line l with slope m = 2              # same as: scalar m = 2; line l with slope=m
line l with intercept k = 5
line l with slope m = 2 and intercept k = 1

A partially declared line with no constraining point is drawn the same way as an underconstrained point — its position is a representative choice, not uniquely determined.

Use through to declare that a line passes through one or more points. This is the mirror of point p on line l and can appear inline on the declaration or as a standalone statement.

line l through p
line l through p, q       # comma-separated
line l through p and q    # or with 'and'
line l = (2,) through p   # combined with partial coefficients
l through p               # standalone

Use parallel or perpendicular to constrain a line's direction relative to another line. These can appear inline on the declaration or as a standalone statement.

line l parallel m            # l has the same direction as m
line l perpendicular m       # l is perpendicular to m
l parallel m                 # standalone form
l perpendicular m
line l parallel line m       # optional 'line' hint

Add at to name the intersection point of two perpendicular lines, or to set the distance between two parallel lines:

line l perpendicular m at p  # l ⊥ m, p is placed at their intersection
line l parallel m at 3       # l ∥ m, distance between them is 3
                             # (produces two symmetric solutions)

Rendered as an infinite dashed line clipped to the viewport.

click to pan & zoom

Circle

A circle declared by its centre and radius.

circle c = (p, 3)           # centre p, radius 3
circle c = ((2, 1), 4)      # centre at (2, 1), radius 4
circle c                    # bare — centre at origin, radius 1

The centre may be a named point or an inline (x, y) tuple. The radius can be a literal number or a scalar reference.

scalar r = 5
circle c = (p, r)

A bare circle declaration circle c chooses a canonical centre and radius the same way bare points and segments do — centre at origin, radius 1.

with center and with radius are clearer alternatives, and either parameter can be specified independently. The = is optional.

circle c with center p
circle c with center=(5, 3)
circle c with radius 3
circle c with center p and radius 3

with diameter is sugar for with radius at half the value. Currently only literal numbers are accepted (no scalar references — there's no arithmetic on scalars yet).

circle c with diameter 6                  # same as: with radius 3
circle c with center p and diameter 8     # same as: with center p and radius 4

The bundled form declares a sub-element and binds it in the same statement:

circle c with center p = (5, 3)      # same as: point p = (5, 3); circle c with center=p
circle c with radius r = 4           # same as: scalar r = 4; circle c with radius=r
circle c with diameter d = 6         # declares scalar d=6 (the diameter), sets r=3

Use on to constrain a point to lie on a circle. With one circle, the point sits on the circle's locus; with two circles (or a circle and a line) the point is placed at their intersection.

point a = (0, 0)
point b = (4, 0)
circle c1 = (a, 3)
circle c2 = (b, 5)
point p
p on c1
p on c2                     # p at (0, ±3)

A circle is also determined uniquely by any three points known to lie on it:

point a = (1, 0)
point b = (-1, 0)
point c = (0, 1)
point o
circle k = (o, 1)
a on k
b on k
c on k                      # o placed at (0, 0)

Segment

A segment between two vertices. The = 5 form is shorthand for a length constraint.

segment ab
segment ab = 5
let segment ab = 5      # 'let' is optional sugar
click to pan & zoom

Triangle

Three vertices with segments ab, bc, ca registered automatically. Inline constraints follow with ... and ....

triangle abc
triangle abc with ab = 3 and bc = 4 and ca = 5
click to pan & zoom

~tilde — geometric language