# Checking if an object in space is a right triangle or a rectangle: is_rectangle

### 14.13.11 Checking if an object in space is a right triangle or a rectangle: is_rectangle

See Section 13.16.7 for checking for right triangles and rectangles in two-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.

#### Examples.

- Input:
  is_rectangle([2,0,0],[2,2,0],[0,2,0])
  Output:

  2

- Input:
  is_rectangle([2,2,0],[-2,2,0],[-2,-1,0],[2,-1,0])
  Output:

  1