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.
Note that R 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.