Previous Up Next

12.13.12  Check if an object in space is a square: is_square

See section 11.16.8 for checking for squares in two-dimensional geometry.

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

is_rectangle returns 1 if the four points are the vertices of a square or if the geometric object is a square, it returns 0 otherwise.

Input:

is_square([2,2,0],[-2,2,0],[-2,-2,0],[2,-2,0])

Output:

1

Input:

S := square([0,0,0],[2,0,0],[0,0,1])

then:

is_square(S)

Output:

1

Input:

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

Output:

0

Previous Up Next