Right triangles in space: right_triangle

### 14.7.3 Right triangles in space: right_triangle

See Section 13.8.3 for right triangles in the plane.

The right_triangle command returns and draws a right triangle. It can take its arguments in different ways.

Three points.

- right_triangle takes three mandatory arguments and one optional argument:
  - A,B,P, three points.
  - Optionally, var, a variable name.
  - right_triangle(A,B,P ⟨,var⟩) returns and draws the right triangle BAC in plane ABP with the right angle at vertex A. The triangle is oriented so that the angle BAC is positive. The length of AC equals the length of AP.
    If the variable name var is given, it will be assigned to the vertex C.

  Example.
  Input:

  A:= point(0,0,0); B:= point(3,3,3);
  P:= point(0,0,3)
  right_triangle(A,B,P);

  Output:

  Three points and a real number.

  - right_triangle takes mandatory three arguments and one optional argument:
    - A,B, two points.
    - [P,k], a list consisting of a point P and a real number k.
    - Optionally, var, a variable name.
  - right_triangle(A,B,[P,k] ⟨,var⟩) returns and draws the right triangle BAC in plane ABP with the right angle at vertex A, and the length of AC equals |k| times the length of AP. Angles BAC and BAP have the same orientation if k is positive; they have opposite orientation if k is negative. So, if β is the angle ABC, then tan(β)=k.
    If the variable name var is given, it will be assigned to the vertex C.

  Examples.

  - Input:
    right_triangle(A,B,[P,2])
    Output:
  - Input:
    right_triangle(A,B,[P,-2])
    Output:
  - Input:

    right_triangle(A,B,[P,2],C)
    coordinates(C)

    Output:

    ⎡ ⎢ ⎣ | −3 | √ |
    2
    | ,−3 | √ |
    2
    | ,6 | √ |
    2
    | ⎤ ⎥ ⎦