Previous Up Next

11.16.10  Check if an object in the plane is a parallelogram: is_parallelogram

See section 12.13.14 for checking for parallelograms in three-dimensional geometry.

The is_parallelogram command takes as argument a geometric object or four points.

is_parallelogram returns 1, 2, 3 or 4 if the object is a parallelogram. It returns 4 if the object is a square, 3 if the object is a rectangle but not a square, 2 if the object is a rhombus but not a rectangle, and returns 1 otherwise. The command returns 0 if the object is not a parallelogram.
Input:

is_parallelogram(i, -1+i, -1-i, 1-i)

Output:

0

Input:

is_parallelogram(1+i, -1+i, -1-i, 1-i)

Output:

1

Input:

Q := quadrilateral(1+i, -1+i, -1-i, 1-i)

then:

is_parallelogram(Q)

Output:

4

Input:

P := parallelogram(-1-i, 1-i, i, D)

then:

is_parallelogram(P[0])

Output:

1

Note that P[0] is a parallelogram since P is a list made of a parallelogram and vertex D. Entering affix(D) returns -2+i.


Previous Up Next