Previous Up Next

12.13.14  Check if an object in space is a parallelogram: is_parallelogram

See section 11.16.10 for checking for parallelograms in two-dimensional geometry.

The is_parallelogram command as arguments either four points or a geometric object.

is_parallelogram returns 4, 3, 2 or 1 if the four points are the vertices of a square, rectangle, rhombus or parallelogram, respectively, or if the geometric object is a square, rectangle, rhombus or parallelogram. It returns 0 otherwise.

Input:

is_parallelogram([0,0,0],[2,0,0],[3,1,0],[1,1,0])

Output:

1

Input:

is_parallelogram([-1,0,0],[0,1,0],[2,0,0],[0,-1,0])

Output:

0

Input:

P := parallelogram([0,0,0],[2,0,0],[1,1,0])

then:

is_parallelogram(P)

Output:

1

Note that
Input:

P := parallelogram([0,0,0],[2,0,0],[1,1,0],D)

defines P to be a list consisting of the parallelogram and the point D; to test if the object is a parallelogram, the first component of P needs to be tested.
Input:

is_parallelogram(P[0])

Output:

1

Input:

is_parallelogram([-1,0,0],[0,1,0],[2,0,0],[0,-1,0])

Output:

0

Previous Up Next