Inversion in space: inversion

### 13.14.7 Inversion in space: inversion

See section 12.15.7 for inversions in the plane.

Given a point P and a real number k, the corresponding inversion of a point A is the point A′ on the ray PA satisfying PA·PA′ = k2.

The inversion command takes two or three arguments. The first argument is a point, the center of inversion; the second argument is a real number, which is the inversion ratio. The optional third argument is the object which is transformed.

With two arguments, inversion returns a new command which does the inversion.
Input:

inver := inversion(point(0,0,0), 2)

then:

inver(point(1,2,-2))

returns and draws the point (2/9, 4/9, −4/9), which is the inversion of (1,2,−2).

With a third argument of a geometric object, inversion returns and draws the transformed object.
Input:

inversion(point(0,0,0), 2, point(1,2,-2))

returns and draws (2/9,4/9,−4/9), as above.