Squared length of a segment in space

### 27.10.8 Squared length of a segment in space

See Section 26.13.3 for squares of lengths in 2D geometry.

The distance2 command finds the square of the distance between two points.

- distance2 takes two arguments: P,Q, two points or two lists with the coordinates of the points.
- distance2(P,Q) returns the square of the distance between P and Q.

#### Example

distance2(point(-1,1,1),point(1,1,1))

or:

distance2([-1,1,1],[1,1,1])

4 |  |  |  |  |  |  |  |  |  |