Class Rectangle
A rectangle, defined by its top left vertex, width and height.
Implements GeoShape
constructor (p: Point, w: number, h: number): Rectangle
Name | Type | Default | Description |
p | Point | | |
w | number | 1 | |
h | number | … | |
readonly Property .h : number
Default value: ...
readonly Property .p : Point
readonly Property .type
Default value: 'rectangle'
readonly Property .w : number
Default value: 1
Accessor .bounds : Bounds
Accessor .centroid : Point
Accessor .circumference : number
Accessor .polygon : Polygon
A polygon class representing this rectangle.
Method .at (t: number): Point
Name | Type | Default | Description |
t | number | | |
Method .collision (r: Rectangle): boolean
Name | Type | Default | Description |
r | Rectangle | | |
Method .contains (p: Point, tolerance: number): boolean
Name | Type | Default | Description |
p | Point | | |
tolerance | number | | |
Method .equals (_other: Polygon): boolean
Name | Type | Default | Description |
_other | Polygon | | |
Method .offset (p: Point): number
Name | Type | Default | Description |
p | Point | | |
Method .padding (top: number, right: number, bottom: number, left: number): Rectangle
Name | Type | Default | Description |
top | number | | |
right | number | | |
bottom | number | | |
left | number | | |
Method .project (p: SimplePoint): Point
Name | Type | Default | Description |
p | SimplePoint | | |
Method .reflect (l: Line): Polygon
Name | Type | Default | Description |
l | Line | | |
Method .rotate (a: number, c: Point): Rectangle|Polygon
Rotates this rectangle by a given angle (in radians), optionally around point c
.
Name | Type | Default | Description |
a | number | | |
c | Point | … | |
Method .scale (sx: number, sy: number): Rectangle
Name | Type | Default | Description |
sx | number | | |
sy | number | … | |
Method .shift (x: number, y: number): Rectangle
Name | Type | Default | Description |
x | number | | |
y | number | … | |
Method .toString (): string
Name | Type | Default | Description |
m | TransformMatrix | | |
Method .translate (p: SimplePoint): Rectangle
Name | Type | Default | Description |
p | SimplePoint | | |
static Method .aroundPoints (points: Iterable<SimplePoint>): Rectangle
Creates the smallest rectangle containing all given points.
Name | Type | Default | Description |
points | Iterable<SimplePoint> | | |