Class: DefPolygon

algeobra~DefPolygon(points)

Definition of a polyon. A polygon is specified by its vertices and differs from a line strip in that it is closed

Constructor

new DefPolygon(points)

Default value
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> An array of points
Source:

Methods

compute(createInfo) → {Object}

Computes the polygon
Parameters:
Name Type Description
createInfo CreateInfo The creation info
Source:
Returns:
A polygon of type TYPE_POLYGON
Type
Object

(static) fromClipLine(poly, line) → {CreateInfo}

Computes a polygon by clipping another polygon at a line
Parameters:
Name Type Description
poly Number | Object Either the index or value of a TYPE_POLYGON. The polygon to be clipped
line Number | Object Either the index or value of a TYPE_LINE. The line to be clipped at
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromClipPointNormal(poly, params) → {CreateInfo}

Computes a polygon by clipping another polygon at a line given by a point and normal If the point is not given, the vectors reference point is used
Parameters:
Name Type Description
poly Number | Object Either the index or value of a TYPE_POLYGON. The polygon to be clipped
params Object
Properties
Name Type Attributes Description
p Number | Object <optional>
Either the index or value of a TYPE_POINT. A point on the clipping line
n Number | Object Either the index or value of a TYPE_VECTOR. The clipping line normal
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromClipPoly(poly, clipPoly) → {CreateInfo}

Computes a polygon by clipping another polygon at a convex clip polygon
Parameters:
Name Type Description
poly Number | Object Either the index or value of a TYPE_POLYGON. The polygon to be clipped
clipPoly Number | Object Either the index or value of a TYPE_POLYGON. The polygon to be clipped at. Must be convex
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromLineStrip(poly, attach) → {CreateInfo}

Computes a polygon from the points of a line strip
Parameters:
Name Type Description
poly Number | Object Either the index or value of a TYPE_LINE_STRIP. The line strip
attach Boolean Whether the points should be attached to the points already specified for this polygon
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPointArray(pointArray, attach) → {CreateInfo}

Computes a polygon from an array of points stored as a value
Parameters:
Name Type Default Description
pointArray Number | Object Either the index or value of an array of points of type TYPE_POINT. The point array
attach Boolean false Whether the points should be attached to the points already specified for this polygon
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPoints(points, attach) → {CreateInfo}

Computes a polygon from an array of points
Parameters:
Name Type Default Description
points Array.<(Number|Object)> Either the indices or values of TYPE_POINT. The points from which to make the polygon of
attach Boolean false Whether the points should be attached to the points already specified for this polygon
Source:
Returns:
The creation info
Type
CreateInfo