# Similarity in space: similarity

### 14.14.6 Similarity in space: similarity

See Section 13.15.6 for similarities in the plane.

The similarity command creates a command to rotate and scale about a given line.

- similarity takes three mandatory arguments and one optional argument:
  - L, a line (the axis of the rotation).
  - r, a real number (the scaling ratio).
  - θ, a real number (the angle of rotation).
  - Optionally, G, a geometric object.
- similarity(L,r,θ) returns a new command which rotates about L through an angle of θ and scales about L by a factor of r. If r is negative, the direction of rotation is reversed.
- similarity(L,r,θ,G) returns and draws the transformation of G.

#### Examples.

- Input:

  S:=sphere([0,0,0],0.5)
  s:= similarity(line(point(0,1,0),point(0,1,1)), 2, 2*pi/3)
  color(S,blue),s(S)

  Output:
- Input:
  similarity(line(point(0,1,0),point(1,1,1)), 2, 2*pi/3, S))
  Output: