Home Manual Reference Source Test Repository
public class | source

Polygon

Describes an polygon

See:

Constructor Summary

Public Constructor
public

constructor(tag: *, duration: *, points: *)

Method Summary

Public Methods
public

clone(): misc.Polygon

Clone a polygon

public
public

getPoints(): Array<misc.Point>

public
public

rotate(originPoint: *, angleDegrees: *): *

Rotate all points of polygon around an origin point

public

rotateAroundZero(angleDegrees: *): misc.Polygon

Optimized algorithm for polygon rotation around coordinate beginning

public

translate(translatePoint: *): *

Translate all points of polygon

Public Constructors

public constructor(tag: *, duration: *, points: *) source

Params:

NameTypeAttributeDescription
tag *

{String} - Additional information about polygon to describe it

duration *

{Number} - Polygon will be destroyed after given number of milliseconds

points *

{Array<misc.Point>} - Array of points which can describe an polygon

Public Methods

public clone(): misc.Polygon source

Clone a polygon

Return:

misc.Polygon

Cloned polygon

public getDuration(): Number source

Return:

Number

Get duration of milliseconds after the polygon will be destroyed

public getPoints(): Array<misc.Point> source

Return:

Array<misc.Point>

Get an array of points which describe a polygon

public getTag(): String source

Return:

String

Get unique identifier of polygon

public rotate(originPoint: *, angleDegrees: *): * source

Rotate all points of polygon around an origin point

Params:

NameTypeAttributeDescription
originPoint *

{misc.Point} Center point of rotation

angleDegrees *

{Number} Required angle of rotation

Return:

*

public rotateAroundZero(angleDegrees: *): misc.Polygon source

Optimized algorithm for polygon rotation around coordinate beginning

Params:

NameTypeAttributeDescription
angleDegrees *

{Number}

Return:

misc.Polygon

public translate(translatePoint: *): * source

Translate all points of polygon

Params:

NameTypeAttributeDescription
translatePoint *

{misc.Point} Point which represents x and y value of translation

Return:

*