# Class: Polygon

# Hierarchy

  • Shape

    Polygon

# Constructors

# constructor

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

Defined in polygon.ts:9 (opens new window)

Parameters:

Name Type
array AnyPoint2D[]

Returns: Polygon

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

Defined in polygon.ts:11 (opens new window)

Parameters:

Name Type
array number[]

Returns: Polygon

# Accessors

# area

get area(): number

Overrides void

Defined in polygon.ts:59 (opens new window)

Returns: number


# bounds

get bounds(): Rectangle

Overrides void

Defined in polygon.ts:54 (opens new window)

Returns: Rectangle


# firstPoint

get firstPoint(): Point2D | null

Defined in polygon.ts:46 (opens new window)

Returns: Point2D | null


# lastPoint

get lastPoint(): Point2D | null

Defined in polygon.ts:50 (opens new window)

Returns: Point2D | null


# points

get points(): Point2D[]

Defined in polygon.ts:42 (opens new window)

Returns: Point2D[]

# Methods

# _updateRequired

_updateRequired(): void

Defined in polygon.ts:32 (opens new window)

Returns: void


# add

add(point: AnyPoint2D): void

Defined in polygon.ts:37 (opens new window)

Parameters:

Name Type
point AnyPoint2D

Returns: void


# isEmpty

isEmpty(): boolean

Defined in polygon.ts:73 (opens new window)

Returns: boolean


# segmentation

segmentation(): number[]

Defined in polygon.ts:64 (opens new window)

Returns: number[]


# Static getArea

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

Defined in polygon.ts:77 (opens new window)

Parameters:

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

Returns: number


# Static getBounds

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

Defined in polygon.ts:95 (opens new window)

Parameters:

Name Type
polygon AnyPoint2D[] | Polygon

Returns: Rectangle


# Static getCentroid

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

Defined in polygon.ts:111 (opens new window)

Parameters:

Name Type
polygon AnyPoint2D[] | Polygon

Returns: Point2D