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

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

See section 12.16.7 for checking for right triangles and rectangles in two-dimensional geometry.

The is_rectangle command checks for both right triangles and rectangles. It takes as arguments either three points, four points, or a geometric object.

If the arguments are three points or a triangle, then is_rectangle returns 1, 2 or 3 if the points form a right triangle which right angle at the first, second or third vertex. It returns 0 otherwise.

If the arguments are four points or a quadrilateral, then is_rectangle returns 2 is the points form a square, 1 is they form a rectangle, and 0 otherwise.

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