Link Search Menu Expand Document

Rectangle

rectangle.ts#L15

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 .area : number

Accessor .center : Point

Accessor .centroid : Point

Accessor .circumference : number

Accessor .edges

Accessor .points

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 .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

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 .transform (m: TransformMatrix): Polygon

Name Type Default Description
m TransformMatrix    

Method .translate (p: Point): Rectangle

Name Type Default Description
p Point    

static Method .aroundPoints (points: Iterable<Point>): Rectangle

Creates the smallest rectangle containing all given points.

Name Type Default Description
points Iterable<Point>    

Copyright © 2021 Mathigon.org