UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

873 lines 56.9 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Polygon | starling-framework</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">starling-framework</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../index.html">starling</a> </li> <li> <a href="../modules/starling.geom.html">geom</a> </li> <li> <a href="starling.geom.polygon.html">Polygon</a> </li> </ul> <h1>Class Polygon</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>A polygon describes a closed two-dimensional shape bounded by a number of straight line segments.</p> </div> <p>The vertices of a polygon form a closed path (i.e. the last vertex will be connected to the first). It is recommended to provide the vertices in clockwise order. Self-intersecting paths are not supported and will give wrong results on triangulation, area calculation, etc.</p> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">Polygon</span> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section tsd-is-external"> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section tsd-is-external"> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#area" class="tsd-kind-icon">area</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#isconvex" class="tsd-kind-icon">is<wbr>Convex</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#issimple" class="tsd-kind-icon">is<wbr>Simple</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#numtriangles" class="tsd-kind-icon">num<wbr>Triangles</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#numvertices" class="tsd-kind-icon">num<wbr>Vertices</a></li> </ul> </section> <section class="tsd-index-section tsd-is-external"> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#addvertices" class="tsd-kind-icon">add<wbr>Vertices</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#clone" class="tsd-kind-icon">clone</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#contains" class="tsd-kind-icon">contains</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#containspoint" class="tsd-kind-icon">contains<wbr>Point</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#copytovertexdata" class="tsd-kind-icon">copy<wbr>ToVertex<wbr>Data</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#getvertex" class="tsd-kind-icon">get<wbr>Vertex</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#get_area" class="tsd-kind-icon">get_<wbr>area</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#get_isconvex" class="tsd-kind-icon">get_<wbr>is<wbr>Convex</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#get_issimple" class="tsd-kind-icon">get_<wbr>is<wbr>Simple</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#get_numtriangles" class="tsd-kind-icon">get_<wbr>num<wbr>Triangles</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#get_numvertices" class="tsd-kind-icon">get_<wbr>num<wbr>Vertices</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#reverse" class="tsd-kind-icon">reverse</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#setvertex" class="tsd-kind-icon">set<wbr>Vertex</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.geom.polygon.html#set_numvertices" class="tsd-kind-icon">set_<wbr>num<wbr>Vertices</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#tostring" class="tsd-kind-icon">to<wbr>String</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.geom.polygon.html#triangulate" class="tsd-kind-icon">triangulate</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.geom.polygon.html#createcircle" class="tsd-kind-icon">create<wbr>Circle</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.geom.polygon.html#createellipse" class="tsd-kind-icon">create<wbr>Ellipse</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.geom.polygon.html#createrectangle" class="tsd-kind-icon">create<wbr>Rectangle</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-external"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">new <wbr>Polygon<span class="tsd-signature-symbol">(</span>vertices<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L21">lib/starling/geom/Polygon.d.ts:21</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a Polygon with the given coordinates.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> vertices: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h5> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>an array that contains either &#39;Point&#39; instances or alternating &#39;x&#39; and &#39;y&#39; coordinates.</p> </div> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="area" class="tsd-anchor"></a> <h3>area</h3> <div class="tsd-signature tsd-kind-icon">area<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L91">lib/starling/geom/Polygon.d.ts:91</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Calculates the total area of the polygon.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="isconvex" class="tsd-anchor"></a> <h3>is<wbr>Convex</h3> <div class="tsd-signature tsd-kind-icon">is<wbr>Convex<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L87">lib/starling/geom/Polygon.d.ts:87</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Indicates if the polygon is convex. In a convex polygon, the vector between any two points inside the polygon lies inside it, as well.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="issimple" class="tsd-anchor"></a> <h3>is<wbr>Simple</h3> <div class="tsd-signature tsd-kind-icon">is<wbr>Simple<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L82">lib/starling/geom/Polygon.d.ts:82</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Indicates if the polygon&#39;s line segments are not self-intersecting. Beware: this is a brute-force implementation with <code>O(n^2)</code>.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="numtriangles" class="tsd-anchor"></a> <h3>num<wbr>Triangles</h3> <div class="tsd-signature tsd-kind-icon">num<wbr>Triangles<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L103">lib/starling/geom/Polygon.d.ts:103</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the number of triangles that will be required when triangulating the polygon.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="numvertices" class="tsd-anchor"></a> <h3>num<wbr>Vertices</h3> <div class="tsd-signature tsd-kind-icon">num<wbr>Vertices<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L97">lib/starling/geom/Polygon.d.ts:97</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the total number of vertices spawning up the polygon. Assigning a value that&#39;s smaller than the current number of vertices will crop the path; a bigger value will fill up the path with zeros.</p> </div> </div> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="addvertices" class="tsd-anchor"></a> <h3>add<wbr>Vertices</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">add<wbr>Vertices<span class="tsd-signature-symbol">(</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L37">lib/starling/geom/Polygon.d.ts:37</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Adds vertices to the polygon. Pass either a list of &#39;Point&#39; instances or alternating &#39;x&#39; and &#39;y&#39; coordinates.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>args: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="clone" class="tsd-anchor"></a> <h3>clone</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">clone<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L29">lib/starling/geom/Polygon.d.ts:29</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a clone of this polygon.</p> </div> </div> <h4 class="tsd-returns-title">Returns <a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="contains" class="tsd-anchor"></a> <h3>contains</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">contains<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L46">lib/starling/geom/Polygon.d.ts:46</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Figures out if the given coordinates lie within the polygon.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="containspoint" class="tsd-anchor"></a> <h3>contains<wbr>Point</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">contains<wbr>Point<span class="tsd-signature-symbol">(</span>point<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Point</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L49">lib/starling/geom/Polygon.d.ts:49</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Figures out if the given point lies within the polygon.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>point: <span class="tsd-signature-type">Point</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="copytovertexdata" class="tsd-anchor"></a> <h3>copy<wbr>ToVertex<wbr>Data</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">copy<wbr>ToVertex<wbr>Data<span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><a href="starling.rendering.vertexdata.html" class="tsd-signature-type">VertexData</a>, targetVertexID<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span>, attrName<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L60">lib/starling/geom/Polygon.d.ts:60</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Copies all vertices to a &#39;VertexData&#39; instance, beginning at a certain target index.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>target: <a href="starling.rendering.vertexdata.html" class="tsd-signature-type">VertexData</a></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> targetVertexID: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> attrName: <span class="tsd-signature-type">string</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="getvertex" class="tsd-anchor"></a> <h3>get<wbr>Vertex</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get<wbr>Vertex<span class="tsd-signature-symbol">(</span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, out<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Point</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Point</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L43">lib/starling/geom/Polygon.d.ts:43</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the coordinates of a certain vertex.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>index: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> out: <span class="tsd-signature-type">Point</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Point</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_area" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>area</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>area<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L92">lib/starling/geom/Polygon.d.ts:92</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_isconvex" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>is<wbr>Convex</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>is<wbr>Convex<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L88">lib/starling/geom/Polygon.d.ts:88</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_issimple" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>is<wbr>Simple</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>is<wbr>Simple<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L83">lib/starling/geom/Polygon.d.ts:83</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_numtriangles" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>num<wbr>Triangles</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>num<wbr>Triangles<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L104">lib/starling/geom/Polygon.d.ts:104</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_numvertices" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>num<wbr>Vertices</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>num<wbr>Vertices<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L98">lib/starling/geom/Polygon.d.ts:98</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="reverse" class="tsd-anchor"></a> <h3>reverse</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">reverse<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L33">lib/starling/geom/Polygon.d.ts:33</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Reverses the order of the vertices. Note that some methods of the Polygon class require the vertices in clockwise order.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="setvertex" class="tsd-anchor"></a> <h3>set<wbr>Vertex</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">set<wbr>Vertex<span class="tsd-signature-symbol">(</span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L40">lib/starling/geom/Polygon.d.ts:40</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Moves a given vertex to a certain position or adds a new vertex at the end.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>index: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="set_numvertices" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> set_<wbr>num<wbr>Vertices</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">set_<wbr>num<wbr>Vertices<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L100">lib/starling/geom/Polygon.d.ts:100</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="tostring" class="tsd-anchor"></a> <h3>to<wbr>String</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">to<wbr>String<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L64">lib/starling/geom/Polygon.d.ts:64</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a string that contains the values of all included points.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="triangulate" class="tsd-anchor"></a> <h3>triangulate</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">triangulate<span class="tsd-signature-symbol">(</span>indexData<span class="tsd-signature-symbol">?: </span><a href="starling.rendering.indexdata.html" class="tsd-signature-type">IndexData</a>, offset<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.rendering.indexdata.html" class="tsd-signature-type">IndexData</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L57">lib/starling/geom/Polygon.d.ts:57</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Calculates a possible representation of the polygon via triangles. The resulting IndexData instance will reference the polygon vertices as they are saved in this Polygon instance, optionally incremented by the given offset.</p> </div> <p>If you pass an indexData object, the new indices will be appended to it. Otherwise, a new instance will be created.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> indexData: <a href="starling.rendering.indexdata.html" class="tsd-signature-type">IndexData</a></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> offset: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="starling.rendering.indexdata.html" class="tsd-signature-type">IndexData</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <a name="createcircle" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> create<wbr>Circle</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <li class="tsd-signature tsd-kind-icon">create<wbr>Circle<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, radius<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, numSides<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L72">lib/starling/geom/Polygon.d.ts:72</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a circle with optimized implementations of triangulation, hitTest, etc.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>radius: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> numSides: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <a name="createellipse" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> create<wbr>Ellipse</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <li class="tsd-signature tsd-kind-icon">create<wbr>Ellipse<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, radiusX<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, radiusY<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, numSides<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L69">lib/starling/geom/Polygon.d.ts:69</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates an ellipse with optimized implementations of triangulation, hitTest, etc.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>radiusX: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>radiusY: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> numSides: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <a name="createrectangle" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> create<wbr>Rectangle</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static tsd-is-external"> <li class="tsd-signature tsd-kind-icon">create<wbr>Rectangle<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, width<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, height<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/geom/Polygon.d.ts#L75">lib/starling/geom/Polygon.d.ts:75</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a rectangle with optimized implementations of triangulation, hitTest, etc.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>width: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>height: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="starling.geom.polygon.html" class="tsd-signature-type">Polygon</a></h4> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="label tsd-is-external"> <span>Externals</span> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.animation.html">starling.animation</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.assets.html">starling.assets</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.core.html">starling.core</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.display.html">starling.display</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.errors.html">starling.errors</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.events.html">starling.events</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.extensions.html">starling.extensions</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.filters.html">starling.filters</a> </li> <li class="current tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.geom.html">starling.geom</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.rendering.html">starling.rendering</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.styles.html">starling.styles</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.text.html">starling.text</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.textures.html">starling.textures</a> </li> <li class=" tsd-kind-module tsd-parent-kind-module tsd-is-external"> <a href="../modules/starling.utils.html">starling.utils</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> </ul> <ul class="current"> <li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external"> <a href="starling.geom.polygon.html" class="tsd-kind-icon">Polygon</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#constructor" class="tsd-kind-icon">constructor</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#area" class="tsd-kind-icon">area</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#isconvex" class="tsd-kind-icon">is<wbr>Convex</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#issimple" class="tsd-kind-icon">is<wbr>Simple</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#numtriangles" class="tsd-kind-icon">num<wbr>Triangles</a> </li> <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#numvertices" class="tsd-kind-icon">num<wbr>Vertices</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#addvertices" class="tsd-kind-icon">add<wbr>Vertices</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#clone" class="tsd-kind-icon">clone</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#contains" class="tsd-kind-icon">contains</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#containspoint" class="tsd-kind-icon">contains<wbr>Point</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#copytovertexdata" class="tsd-kind-icon">copy<wbr>ToVertex<wbr>Data</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a href="starling.geom.polygon.html#getvertex" class="tsd-kind-icon">get<wbr>Vertex</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a href="starling.geom.polygon.html#get_area" class="tsd-kind-icon">get_<wbr>area</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a href="starling.geom.polygon.html#get_isconvex" class="tsd-kind-icon">get_<wbr>is<wbr>Convex</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a href="starling.geom.polygon.html#get_issimple"