# Operations on Points and Lines

All the usual equality, membership and subset functions are provided along with a collection of deconstruction functions and others.

## Elementary Operations

### `p eq q: PlanePt, PlanePt -> BoolElt`

Returns `true` if the points $p$ and $q$ are equal, otherwise `false`.

### `p ne q: PlanePt, PlanePt -> BoolElt`

Return `true` if the points $p$ and $q$ are not equal, otherwise `false`.

### `l eq m: PlaneLn, PlaneLn -> BoolElt`

Return `true` if the lines $l$ and $m$ are equal, otherwise `false`.

### `l ne m: PlaneLn, PlaneLn -> BoolElt`

Return `true` if the lines $l$ and $m$ are not equal, otherwise `false`.

### `p in l: PlanePt, PlaneLn -> BoolElt`

Return `true` if point $p$ lies on the line $l$, otherwise `false`.

### `p notin l: PlanePt, PlaneLn -> BoolElt`

Return `true` if point $p$ does not lie on the line $l$, otherwise `false`.

### `S subset l: { PlanePt}, PlaneLn -> BoolElt`

Given a subset $S$ of the point set of the plane $P$ and a line $l$ of $P$, return `true` if the subset $S$ of points lies on the line $l$, otherwise `false`.

### `S notsubset l: { PlanePt}, PlaneLn -> BoolElt`

Given a subset $S$ of the point set of the plane $P$ and a line $l$ of $P$, return `true` if the subset $S$ of points does not lie on the line $l$, otherwise `false`.

### `l meet m: PlaneLn, PlaneLn -> PlanePt`

The unique point common to the lines $l$ and $m$.

### `Representative(l): PlaneLn -> PlanePt`

### `Rep(l): PlaneLn -> PlanePt`

Given a line $l$ of the plane $P$, return a representative point of $P$ which is incident with $l$.

### `Random(l): PlaneLn -> PlanePt`

Given a line $l$ of the plane $P$, return a random point of $P$ which is incident with $l$.

## Deconstruction Functions

### `Index(P, p): Plane, PlanePt -> RngIntElt`

Given a point $p$ from the point–set $V$ of a plane $P$, return the index of $p$, i.e. the integer $i$ such that $p$ is `V.i`.

### `Index(P, l): Plane, PlaneLn -> RngIntElt`

Given a line $l$, return the index of $l$ in the plane $P$, i.e. the integer $i$ such that $l$ is $L.i$ (where $L$ is the line–set of $P$).

### `p[i]: PlanePt, RngIntElt -> FldFinElt`

The $i$-th coordinate of the point $p$, which must be from a classical plane. If $p$ is from a projective plane, then $i$ must satisfy $1 \le i \le 3$; if $p$ is from an affine plane, then $i$ must satisfy $1 \le i \le 2$.

### `l[i]: PlaneLn, RngIntElt -> FldFinElt`

The $i$-th coordinate of the line $l$, which must be from a classical plane. The integer $i$ must satisfy $1 \le i \le 3$. Recall that in a classical plane $\left<a:b:c\right>$ (where $a, b, c \in K$) represents the line given by the equation $ax + by + cz = 0$ in a projective plane or $ax + by + c = 0$ in an affine plane.

### `Coordinates(P, p): Plane, PlanePt -> [ FldFinElt ]`

Given a point $p = (a:b:c)$ from a classical projective plane $P$ (or $p = (a,b)$ from a classical affine plane $P$), return the sequence $[a, b, c]$ (or $[a, b]$ in the affine case) of coordinates of $p$.

### `Coordinates(P, l): Plane, PlaneLn -> [ FldFinElt ]`

Given a line $l = \left<a:b:c\right>$ from a classical plane $P$ (projective or affine), return the sequence $[a, b, c]$ of coordinates of $l$.

### `ElementToSequence(p): PlanePt -> [ FldFinElt ]`

### `Eltseq(p): PlanePt -> [ FldFinElt ]`

Given a point $p = (a:b:c)$ from a classical projective plane $P$ (or $p = (a,b)$ from a classical affine plane $P$), return the sequence $[a, b, c]$ (or $[a, b]$ in the affine case) of coordinates of $p$.

### `ElementToSequence(l): PlaneLn -> [ FldFinElt ]`

### `Eltseq(l): PlaneLn -> [ FldFinElt ]`

Given a line $l = \left<a:b:c\right>$ from a classical plane $P$ (projective or affine), return the sequence $[a, b, c]$ of coordinates of $l$.

### `Set(l): PlaneLn -> { PlanePt }`

The set of points contained in the line $l$.

### `Example: decon (ex-b3b9f2)`

The following example illustrates the use of some of the elementary and deconstruction functions on lines and points discussed in the previous two subsections.

```magma
> K<w> := GF(4);
> P, V, L := FiniteProjectivePlane(K);

```

Create the line $x + z = 0$:

```magma
> l := L![1, 0, 1];
> l;
< 1 : 0 : 1 >

```

Look at the points on the line $l$:

```magma
> Set(l);
{  ( 0 : 1 : 0 ), ( 1 : w^2 : 1 ), ( 1 : 0 : 1 ),
   ( 1 : w : 1 ), ( 1 : 1 : 1) }

```

Get the coordinates of the line $l$:

```magma
> Coordinates(P, l);
[ 1, 0, 1 ]
> l[1];
1

```

Find the index of the line $l$ in the line–set $L$ of $P$, and check it:

```magma
> Index(P, l);
8
> l eq L.8;
true

```

Test if a point is on the line $l$:

```magma
> V![1, 0, 1] in l;
true

```

Test a set of points for containment in $l$:

```magma
> S := {V.1, V.2};
> S;
{  ( 1 : 0 : 0 ), ( 0 : 1 : 0 ) }
> S subset l;
false

```

Create the line containing the points in $S$:

```magma
> l2 := L!S;
> l2;
< 0 : 0 : 1 >
> S subset l2;
true

```

And finally, find the point common to the lines $l$ and $l2$:

```magma
> p := l meet l2;
> p;
( 0 : 1 : 0 )
> p[3];
0

```

## Other Point and Line Functions

### `IsCollinear(P, S): Plane, { PlanePt} -> BoolElt, PlaneLn`

Return `true` if the set $S$ of points of the plane $P$ are collinear, otherwise `false`. If the points are collinear, the line which they define is also returned.

### `IsConcurrent(P, R): Plane, { PlaneLn} -> BoolElt, PlanePt`

Return `true` if the set $R$ of lines of the plane $P$ are concurrent, otherwise `false`. If the lines are concurrent, their common point is returned as a second value.

### `ContainsQuadrangle(P, S): Plane, { PlanePt } -> BoolElt`

Return `true` if the set $S$ of points of a plane $P$ contains a quadrangle.

### `Pencil(P, p): Plane, PlanePt -> { PlaneLn }`

The pencil of lines passing through the point $p$ in the plane $P$.

### `Slope(l): PlaneLn -> FldFinElt`

The slope of the line $l$ of a classical affine plane $P$.

### `IsParallel(P, l, m): Plane, PlaneLn, PlaneLn -> BoolElt`

Return `true` if the line $l$ is parallel to the line $m$ in the affine plane $P$.

### `ParallelClass(P, l): Plane, PlaneLn -> { PlaneLn }`

The parallel class containing the line $l$ of an affine plane $P$.

### `ParallelClasses(P): PlaneAff -> { { PlaneLn } }`

The partition into parallel classes of the lines of the affine plane $P$.

### `Example: Elt Other (ex-c0212f)`

We use the affine plane $AG_2(3)$ to demonstrate some of the above functions.

```magma
> A, V, L := FiniteAffinePlane(3);

```

Create the line $y = 2x + 1$ in A, and check its slope:

```magma
> l := L![2, 1];
> l;
< 1 : 1 : 2 >
> Slope(l);
2

```

Find the lines parallel to $l$:

```magma
> ParallelClass(l);
{
    < 1 : 1 : 0 >,
    < 1 : 1 : 1 >,
    < 1 : 1 : 2 >
}
> [Slope(m): m in ParallelClass(l)];
[ 2, 2, 2 ]

```

Get the pencil of lines through a point of $l$:

```magma
> p := Rep(l);
> p;
( 1, 0 )
> Pencil(A, p);
{
    < 1 : 0 : 2 >,
    < 1 : 1 : 2 >,
    < 1 : 2 : 2 >,
    < 0 : 1 : 0 >
}

```
