Polygon class

A polygon utility class.

Signature:

declare class Polygon 

Constructors

Constructor

Modifiers

Description

(constructor)({ holes, points, })

Constructor.

Properties

Property

Modifiers

Type

Description

holes

readonly

Polygon[]

The primary polygon points.

points

readonly

Point[]

The list of polygon holes.

Methods

Method

Modifiers

Description

compare(a, b)

static

Suitable for use in Array.sort.

contains(point)

Check whether this polygon contains a point.

flipY()

Flip the Y coordinate for all points and holes.

getArea()

Get the area of the polygon.

getBoundingBox()

Get the bounding box of this polygon.

getCenter()

Get the center of the bounding box.

intersects(polygon)

Check whether this polygon intersects with the given polygon.

merge(polygons)

Merge a polygon with this polygon.

toJSON()

Get in touch

We'd love to learn more about your vision and how we can help.

PressPrivacyTermsSupportCopyright © 2024 Core3D, Inc. All Rights Reserved.