### 27.11.11 Checking whether an object in space is a right triangle or a rectangle

See Section 26.15.7 for checking for right triangles and rectangles in 2D geometry.

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

- is_rectangle takes 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

is_rectangle([2,0,0],[2,2,0],[0,2,0])

2 |  |  |  |  |  |  |  |  |  |

is_rectangle([2,2,0],[-2,2,0],[-2,-1,0],[2,-1,0])

1 |  |  |  |  |  |  |  |  |  |