Checking whether an object in the plane is a square

### 24.15.8 Checking whether an object in the plane is a square

See Section 25.11.12 for checking for squares in three-dimensional geometry.

The is_square command determines whether or not a geometric object is a square.

- is_square takes G, a geometric object or a sequence of four points assumed to be the vertices of a quadrilateral.
- is_square(G) returns 1 if the object is a square and returns 0 otherwise.

#### Examples

is_square(1+i,-1+i,-1-i,1-i)

1 |  |  |  |  |  |  |  |  |  |

K:=square(1+i,-1+i); is_square(K)

1 |  |  |  |  |  |  |  |  |  |

K:=square(1+i,-1+i,C,D); is_square(K[0])

1 |  |  |  |  |  |  |  |  |  |

Note that K[0] is a square since K is a list made of a square and vertices C and D.

affix(C,D)

−1−i,1−i |  |  |  |  |  |  |  |  |  |

is_square(i,-1+i,-1-i,1-i)

0 |  |  |  |  |  |  |  |  |  |