Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Polygon

Polygon 类封装了坐标空间中封闭的二维区域的描述。此区域以任意条线段为边界,每条线段都是多边形的一条边。 在内部,一个多边形包含一组 (x,y) 坐标对,其中每个坐标对应多边形的一个顶点,且两个连续的坐标对是多边形一条边的端点。 第一个和最后一个 (x,y) 坐标对通过一条线段相连,形成一个封闭的多边形。 此 Polygon 是按奇-偶性旋绕规则来定义的。

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _len

_len: any

Protected _points

_points: Array<ArrayPoint2>

Methods

addPoint

  • addPoint(x: number, y: number): this
  • Appends new point to this Polygon.

    Parameters

    • x: number
    • y: number

    Returns this

bounds

clone

  • clone(): this

equals

inside

intersects

isEmpty

  • isEmpty(): boolean

numberVertexes

  • numberVertexes(): number
  • Returns number

onside

perimeter

  • perimeter(): number

vertexes