### 11.14.2 The distance between objects in the plane: distance

See section 12.12.7 for distances in three-dimensional geometry.

The distance command takes two arguments; either two points or two geometric objects.

distance returns the distance between the two arguments.
Input:

distance(-1, 1+i)

Output:

sqrt(5)

Input:

distance(0, line(-1,1+i))

Output:

sqrt(5)/5

Input:

distance(circle(0,1),line(-2,1+3*i))

Output:

sqrt(2) - 1

Note that when the distance calculation uses parameters, Xcas must be in real mode. In real mode:
Input:

assumes(a=[4,0,5,0.1]); A := point(0); B := point(a);

and then:

simplify(distance(A,B)); simplify(distance(B,A))

Output:

|a|, |a|

In complex mode:
Input:

assumes(a=[4,0,5,0.1]); A := point(0); B := point(a);

and then:

simplify(distance(A,B)); simplify(distance(B,A))

Output:

-a, a

The distance command has distanceat and distanceatraw versions (see section 11.14.1).