### 11.16.7 Check if an object in the plane is a right triangle or a rectangle: is_rectangle

See section 12.13.11 for checking for right triangles and rectangles
in three-dimensional geometry.

The is_rectangle command takes as argument a geometric object or a
sequence of three or four points.

When the argument is a triangle or three points, is_rectangle returns
1, 2 or 3 if the triangle is a right
triangle; the number indicates which vertex has the right angle.
When the argument is a quadrilateral or four points, is_rectangle returns
1 or 2 if the quadrilateral is a rectangle;
1 if it is a rectangle but not a square and 2 if it
is a square. The command returns 0 if the object is not a
right triangle or rectangle.

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)

then:

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. Entering
affix(C,D) returns -2+8*i, 1+8*i.