# Class: Polygon

# Hierarchy

  • Shape

    Polygon

# Constructors

# constructor

+ new Polygon(array: AnyPoint2D[]): Polygon

Defined in polygon.ts:9

Parameters:

Name Type
array AnyPoint2D[]

Returns: Polygon

+ new Polygon(array: number[]): Polygon

Defined in polygon.ts:11

Parameters:

Name Type
array number[]

Returns: Polygon

# Accessors

# area

get area(): number

Overrides void

Defined in polygon.ts:59

Returns: number


# bounds

get bounds(): Rectangle

Overrides void

Defined in polygon.ts:54

Returns: Rectangle


# firstPoint

get firstPoint(): Point2D | null

Defined in polygon.ts:46

Returns: Point2D | null


# lastPoint

get lastPoint(): Point2D | null

Defined in polygon.ts:50

Returns: Point2D | null


# points

get points(): Point2D[]

Defined in polygon.ts:42

Returns: Point2D[]

# Methods

# _updateRequired

_updateRequired(): void

Defined in polygon.ts:32

Returns: void


# add

add(point: AnyPoint2D): void

Defined in polygon.ts:37

Parameters:

Name Type
point AnyPoint2D

Returns: void


# isEmpty

isEmpty(): boolean

Defined in polygon.ts:73

Returns: boolean


# segmentation

segmentation(): number[]

Defined in polygon.ts:64

Returns: number[]


# Static getArea

getArea(polygon: AnyPoint2D[] | Polygon, signed: boolean): number

Defined in polygon.ts:77

Parameters:

Name Type Default
polygon AnyPoint2D[] | Polygon -
signed boolean false

Returns: number


# Static getBounds

getBounds(polygon: AnyPoint2D[] | Polygon): Rectangle

Defined in polygon.ts:95

Parameters:

Name Type
polygon AnyPoint2D[] | Polygon

Returns: Rectangle


# Static getCentroid

getCentroid(polygon: AnyPoint2D[] | Polygon): Point2D

Defined in polygon.ts:111

Parameters:

Name Type
polygon AnyPoint2D[] | Polygon

Returns: Point2D