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:
Output:
Input:
Output: