File: ../../Developer.FoundationDotJS.org/wwwroot/Library/Foundation.Geometry.js

Foundation
Class Polygon

Object
  
 
 
Foundation.Polygon

All Implemented Interfaces:

Class


Foundation.Polygon

implements Foundation.Class

Two dimensional polygon class, implemented as an array of Foundation.Points, though it is not a true Array.


Constructor Summary
Foundation.Polygon(/*Number*/ x, /*Number*/ y, ...)
Creates a polygon from x and y pairs.
Foundation.Polygon(/*Polygon*/ polygon)
Creates a polygon from another polygon or Array of Foundation.Points.

Field Summary
Numberlength
The number of points in the polygon.
Rectanglerectangle
The bounding rectangle of all the points in the polygon.

Method Summary
Polygonclone()
Creates a copy of the polygon.
BooleancontainsPoint(/*Point*/ point)
Checks to see if a point is inside the polygon.
 dispose()

Methods inherited from Foundation.Class
getTypePath, isInstanceOf

Constructor Detail

Polygon

Foundation.Polygon(/*Number*/ x,
                   /*Number*/ y,
                   ...)

Creates a polygon from x and y pairs.

Parameters:
x ⌉ 
(Optional)(These 2 parameters in groups) The x,y verticies of the polygon.
y ⌋ 
(Optional)(Repeatable group) The x,y verticies of the polygon.

Polygon

Foundation.Polygon(/*Polygon*/ polygon)

Creates a polygon from another polygon or Array of Foundation.Points.

Parameters:
polygon - 
Polygon to copy.

Field Detail

length

Number length

The number of points in the polygon.


rectangle

Rectangle rectangle

The bounding rectangle of all the points in the polygon.

Method Detail

clone

Polygon clone()

Creates a copy of the polygon.

Returns:
A new copy of the polygon.

containsPoint

Boolean containsPoint(/*Point*/ point)

Checks to see if a point is inside the polygon.

Parameters:
point - 
The point to check.
Returns:
True if the point is inclusively inside the polygon, else false.

dispose

dispose()
Overrides:
dispose in class Class