Next: Drawing, Previous: Quadrilaterals [Contents][Index]

### 3.5 Locus Assignments

A locus assignment is useful to generate a set of points giving an approximation of a locus. It consists in a locus statement followed by a block of instructions delimited by `end`. The instruction block must contain a put statement, i.e. the `put` keyword followed by a point-valued expression. The syntax for locus statements is:

    locus l(t = a to b { step n })

The associated instruction block is repeated n times with values of number t increasing from a to b. Each put statement appends a point to the resulting set l. Default value for n is 120.

#### Examples

A cardioid.

    locus C(t = 0 to 360)
      put point(sin(t/2), t°)
    end

A quadratrix generated from the intersection of two uniformly-moving lines: one angular, one linear (original script by Robert D. Goulding).

    locus q(t = 10^-3 to 1)
      l1 = line(point(0, 0), t*pi/2 rad)
      l2 = line(point(0, t), 0 rad)
      put intersection(l1, l2)
    end