Docs updated

This commit is contained in:
Mat Groves 2013-11-02 11:37:42 +00:00
parent a46b74f8ca
commit 6c762fb396
119 changed files with 38715 additions and 9039 deletions

View file

@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;core&#x2F;Polygon.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
<title>src/pixi/core/Polygon.js - Pixi.JS</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
@ -15,7 +15,7 @@
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
<h1><img src="http://www.goodboydigital.com/pixijs/logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
@ -41,71 +41,95 @@
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="../classes/AbstractFilter.html">AbstractFilter</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/CanvasGraphics.html">CanvasGraphics</a></li>
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="../classes/BlurFilter.html">BlurFilter</a></li>
<li><a href="..&#x2F;classes/Circle.html">Circle</a></li>
<li><a href="../classes/CanvasGraphics.html">CanvasGraphics</a></li>
<li><a href="..&#x2F;classes/CustomRenderable.html">CustomRenderable</a></li>
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="../classes/Circle.html">Circle</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
<li><a href="..&#x2F;classes/Ellipse.html">Ellipse</a></li>
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
<li><a href="..&#x2F;classes/Graphics.html">Graphics</a></li>
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="../classes/Ellipse.html">Ellipse</a></li>
<li><a href="..&#x2F;classes/JsonLoader.html">JsonLoader</a></li>
<li><a href="../classes/EventTarget.html">EventTarget</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="../classes/Graphics.html">Graphics</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
<li><a href="..&#x2F;classes/Polygon.html">Polygon</a></li>
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="../classes/InvertFilter.html">InvertFilter</a></li>
<li><a href="..&#x2F;classes/RenderTexture.html">RenderTexture</a></li>
<li><a href="../classes/JsonLoader.html">JsonLoader</a></li>
<li><a href="..&#x2F;classes/Spine.html">Spine</a></li>
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="../classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="../classes/Polygon.html">Polygon</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="../classes/PolyK._convex.html">PolyK._convex</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="../classes/PolyK._PointInTriangle.html">PolyK._PointInTriangle</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="../classes/PolyK.AjaxRequest.html">PolyK.AjaxRequest</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="../classes/PolyK.InteractionData.html">PolyK.InteractionData</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
<li><a href="../classes/PolyK.InteractionManager.html">PolyK.InteractionManager</a></li>
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
<li><a href="../classes/RenderTexture.html">RenderTexture</a></li>
<li><a href="../classes/SepiaFilter.html">SepiaFilter</a></li>
<li><a href="../classes/Spine.html">Spine</a></li>
<li><a href="../classes/Sprite.html">Sprite</a></li>
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="../classes/Stage.html">Stage</a></li>
<li><a href="../classes/Text.html">Text</a></li>
<li><a href="../classes/Texture.html">Texture</a></li>
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="../classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="../classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
<li><a href="../modules/PIXI.html">PIXI</a></li>
</ul>
</div>
@ -142,23 +166,30 @@
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;core&#x2F;Polygon.js</h1>
<h1 class="file-heading">File: src/pixi/core/Polygon.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
/**
* @author Adrien Brault &lt;adrien.brault@gmail.com&gt;
*&#x2F;
*/
&#x2F;**
/**
* @class Polygon
* @constructor
* @param points {Array&lt;Point&gt;|Array&lt;Number&gt;} This cna be an array of Points or a flat array of numbers
* that will be interpreted as [x,y, x,y, ...]
*&#x2F;
* @param points* {Array&lt;Point&gt;|Array&lt;Number&gt;|Point...|Number...} This can be an array of Points that form the polygon,
* a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be
* all the points of the polygon e.g. &#x60;new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)&#x60;, or the
* arguments passed can be flat x,y values e.g. &#x60;new PIXI.Polygon(x,y, x,y, x,y, ...)&#x60; where &#x60;x&#x60; and &#x60;y&#x60; are
* Numbers.
*/
PIXI.Polygon = function(points)
{
&#x2F;&#x2F;if this is a flat array of numbers, convert it to points
//if points isn&#x27;t an array, use arguments as the array
if(!(points instanceof Array))
points = Array.prototype.slice.call(arguments);
//if this is a flat array of numbers, convert it to points
if(typeof points[0] === &#x27;number&#x27;) {
var p = [];
for(var i = 0, il = points.length; i &lt; il; i+=2) {
@ -173,10 +204,12 @@ PIXI.Polygon = function(points)
this.points = points;
}
&#x2F;**
/**
* Creates a clone of this polygon
*
* @method clone
* @return a copy of the polygon
*&#x2F;
* @return {Polygon} a copy of the polygon
*/
PIXI.Polygon.prototype.clone = function()
{
var points = [];
@ -187,22 +220,24 @@ PIXI.Polygon.prototype.clone = function()
return new PIXI.Polygon(points);
}
&#x2F;**
/**
* Checks if the x, and y coords passed to this function are contained within this polygon
*
* @method contains
* @param x {Number} The X coord of the point to test
* @param y {Number} The Y coord of the point to test
* @return if the x&#x2F;y coords are within this polygon
*&#x2F;
* @return {Boolean} if the x/y coords are within this polygon
*/
PIXI.Polygon.prototype.contains = function(x, y)
{
var inside = false;
&#x2F;&#x2F; use some raycasting to test hits
&#x2F;&#x2F; https:&#x2F;&#x2F;github.com&#x2F;substack&#x2F;point-in-polygon&#x2F;blob&#x2F;master&#x2F;index.js
// use some raycasting to test hits
// https://github.com/substack/point-in-polygon/blob/master/index.js
for(var i = 0, j = this.points.length - 1; i &lt; this.points.length; j = i++) {
var xi = this.points[i].x, yi = this.points[i].y,
xj = this.points[j].x, yj = this.points[j].y,
intersect = ((yi &gt; y) != (yj &gt; y)) &amp;&amp; (x &lt; (xj - xi) * (y - yi) &#x2F; (yj - yi) + xi);
intersect = ((yi &gt; y) != (yj &gt; y)) &amp;&amp; (x &lt; (xj - xi) * (y - yi) / (yj - yi) + xi);
if(intersect) inside = !inside;
}
@ -210,8 +245,8 @@ PIXI.Polygon.prototype.contains = function(x, y)
return inside;
}
PIXI.Polygon.constructor = PIXI.Polygon;
// constructor
PIXI.Polygon.prototype.constructor = PIXI.Polygon;
</pre>
</div>
@ -222,13 +257,13 @@ PIXI.Polygon.constructor = PIXI.Polygon;
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>