Rectangle

The Rectangle class represents an abstract rectangular area. It is different from a rectangle mark.

Properties

propertyexplanationtypedefault value
leftthe x coordinate of the left hand side of the rectangleNumber
topthe y coordinate of the top of the rectangleNumber
right the x coordinate of the right hand side of the rectangleNumber
bottom the y coordinate of the bottom of the rectangleNumber
center the x coordinate of the center of the rectangleNumber
middle the y coordinate of the center of the rectangleNumber
x the x coordinate of the center of the rectangle
same as “center”
Number
y the y coordinate of the center of the rectangle
same as “middle”
Number
widththe width of the rectangleNumber
heightthe height of the rectangleNumber

Methods

methodexplanationreturn type
contains(x, y)check if a point with the specified x and y coordinates (type Number)
is inside this rectangle
Boolean
union(rect)returns the union of this rectangle and the parameter rect (type Rectangle)Rectangle
clone()returns a copy of this rectangleRectangle