### 26.17.1 Loci

The locus command draws the locus of points determined by geometric objects moving in the plane, where the object depends on a point moving along a curve. It can draw a locus of points which depends on points on a curve, or the envelope of a family of lines depending on points on a curve.

##### The locus of points depending on points on a curve.

- For drawing the locus of points depending on points on a curve, locus takes two mandatory arguments and two optional arguments:
  - var1, a variable name which has already been assigned to a point, which itself is a function of var2, the second argument.
  - var2, a variable name assigned to element(C) for some curve C (see Section 26.5.15).
  - Optionally, t=a..b, where t is the parameter of the curve C. (You can double check the name of the parameter for a curve C with the command parameq(C).)
  - Optionally, tstep=s, to set the step size for the parameter t.
- locus(var1,var2 ⟨,tstep=c ⟩) draws the locus of points formed by var1, as var2 traces over the curve C.

  With the optional arguments, C is limited to the part parameterized from a to b with step size c.

#### Example

This will draw the set of isobarycenters of the triangles with vertices -1, 1 and P, where P ranges over the line through i and i+1.

P:=element(line(i,i+1)); G:=isobarycenter(-1,1,P); locus(G,P)

locus(G,P,t=-3..3,tstep=0.1)

##### The envelope of a family of lines which depend on points on a curve.

For drawing the envelope of a family of lines which depend on points on a curve:

- locus takes two mandatory arguments and two optional arguments.
  - var1, a variable name which has already been assigned to a line, which itself is a function of var2, the second argument.
  - var2, a variable name which has already been assigned to element(C) for some curve C (see Section 26.5.15).
  - Optionally, t=a..b, where t is the parameter of the curve C. (You can double check the name of the parameter for a curve C with the command parameq(C).)
  - Optionally, tstep=s, to set the step size for the parameter t.
- locus(var1,var2 ⟨,tstep=c ⟩) draws the envelope of lines formed by var1, as var2 traces over the curve C.

  With the optional arguments, C is limited to the part parameterized from a to b with step size c.

#### Examples

This will draw the envelope of the family of perpendicular bisectors of the segments from the point 1 to the points on the line x=0.

F,H:=point(1),element(line(x=0)); d:=perpen_bisector(F,H); locus(d,H)

To draw the envelope of a family of lines which depend on a parameter, such as the lines given by the equations y+x tan(t)−2sin(t)=0 over the parameter t, the parameter can be regarded as the affixes of points on the line y=0.

H:=element(line(y=0)); D:=line(y+x*tan(affix(H))-2*sin(affix(H))); locus(D,H)

locus(D,H,t=0..pi)