Right triangles in the plane

### 26.7.3 Right triangles in the plane

See Section 27.6.3 for right triangles in space.

The right_triangle command creates right triangles.

- right_triangle takes three mandatory arguments and one optional argument:
  - A,B, two points.
  - k, a nonzero real number.
  - Optionally var, a variable name.
- right_triangle(A,B,k ⟨,var ⟩) returns and draws the right triangle ABC, with the right angle at A and with length(AC)=|k|·length(AB). If k > 0, then AB to AC is counterclockwise; if k < 0 then AB to AC is clockwise.

  With the argument var, c will be assigned to var.

#### Examples

right_triangle(1+i,1-i,2)

right_triangle(1+i,1-i,-2)

right_triangle(1+i,1-i,2,C)

affix(C)

5+i |  |  |  |  |  |  |  |  |  |