Class: Geometry.Shapes.Rectangle
Geometry Rectangle Shape Class
Description
Summary:
- Represents a rectangle drawn on a grid
Usage
Constructs an instance of Rectangle from the supplied width, height, and origin
new Geometry.Shapes.Rectangle(width, height, originopt)
- Implements:
- Geometry.Interfaces.Shape
Parameters:
Name | Type | Default | Description |
---|---|---|---|
width
|
Number |
how wide the rectangle should be |
|
height
|
Number |
how high the rectangle should be |
|
originopt
|
Geometry.Utils.Point | Point(0, 0) |
which point on the grid to start the rectangle from |
Properties:
Name | Type | Description |
---|---|---|
width
|
Number |
the horizontal width of the rectangle |
height
|
Number |
the vertical height of the rectangle |
Methods
area() → {Number}
Calculate the amount of space taken up by the rectangle
- Implements:
- Geometry.Interfaces.Shape#area
Returns:
the amount of space taken up by the shape
perimeter() → {Number}
Calculate the total length of all four sides of the rectangle
- Implements:
- Geometry.Interfaces.Shape#perimeter
Returns:
the total length of all lines of the shape