Square

A square is a rectangle with equal width and height.

Constructor

new Square(center, side_length, rotationopt)

Creates a new Square from a center point, side length, and optional rotation.

Parameters:
NameTypeAttributesDescription
centerPoint2D

The center point of the square as a Point2D.

side_lengthnumber

The side length of the square.

rotationnumber | null<optional>

The rotation of the square, if any.

Classes

Square

Members

area

Returns the area of the square.

center

Returns the center point of the square.

perimeter

Returns the perimeter of the square.

rectangle

Creates a new Rectangle from the square.

rotation

Returns the rotation of the square.

side_length

Returns the side length of the square.

vector_object_builder

Creates a VectorObjectBuilder from the square.