Checking if an object in the plane is a right triangle or a rectangle: is_rectangle

### 13.16.7 Checking if an object in the plane is a right triangle or a rectangle: is_rectangle

See Section 14.13.11 for checking for right triangles and rectangles in three-dimensional geometry.

The is_rectangle command determines whether or not a geometric object is an rectangle or a right triangle.

- is_rectangle takes one argument:
  G, a geometric object or a sequence of three or four points assumed to be the vertices of a triangle or a quadrilateral.
- is_rectangle(G) returns:
  - (for triangle G) 1,2 or 3 if G is a right triangle (the number indicates which vertex is has the right angle).
  - (for quadrilaterals G) 1 if G is a rectangle but not a square.
  - (for quadrilaterals G) 2 if G is square.
  - 0 otherwise.

  Example.
  Input:

  is_rectangle(1,1+i,i)

  Output:

  2

- Input:
  is_rectangle(1+i, -2+i, -2-i, 1-i)
  Output:

  1

- Input:

  R:= rectangle(-2-i,1-i, 3, C, D)
  is_rectangle(R[0])

  Output:

  1

  Note that R[0] is a rectangle since R is a list made of a rectangle and vertices C and D.
  Input:
  affix(C,D)
  Output:

  −2+8 i,1+8 i