Docs updated
example updated misplaced files removed
This commit is contained in:
parent
72e38cccb0
commit
e91be9b53a
100 changed files with 6387 additions and 12207 deletions
|
@ -49,6 +49,8 @@
|
|||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasGraphics.html">CanvasGraphics</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
|
@ -57,6 +59,8 @@
|
|||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
@ -143,28 +147,24 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A DisplayObjectContainer represents a collection of display objects. It is the base class of all display objects that act as a container for other objects.
|
||||
* @class DisplayObjectContainer
|
||||
* @extends DisplayObject
|
||||
* @constructor
|
||||
* A set of functions used by the webGL renderer to draw the primitive graphics data
|
||||
* @class CanvasGraphics
|
||||
*/
|
||||
PIXI.WebGLGraphics = function()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// constructor
|
||||
PIXI.WebGLGraphics.constructor = PIXI.WebGLGraphics;
|
||||
|
||||
PIXI.WebGLGraphics.renderGraphics = function(graphics)
|
||||
PIXI.WebGLGraphics.renderGraphics = function(graphics, projection)
|
||||
{
|
||||
PIXI.activatePrimitiveShader();
|
||||
var gl = PIXI.gl;
|
||||
|
||||
// graphicsObject
|
||||
// a collection of "shapes" (mainly lines right now!)
|
||||
if(!graphics._webGL)graphics._webGL = {points:[], lastPosition:new PIXI.Point(), lastIndex:0, buffer:gl.createBuffer()};
|
||||
if(!graphics._webGL)graphics._webGL = {points:[], indices:[], lastIndex:0,
|
||||
buffer:gl.createBuffer(),
|
||||
indexBuffer:gl.createBuffer()};
|
||||
|
||||
if(graphics.dirty)
|
||||
{
|
||||
|
@ -178,21 +178,32 @@ PIXI.WebGLGraphics.renderGraphics = function(graphics)
|
|||
graphics._webGL.points = [];
|
||||
}
|
||||
|
||||
PIXI.WebGLGraphics.initGraphics(graphics);
|
||||
PIXI.WebGLGraphics.updateGraphics(graphics);
|
||||
}
|
||||
|
||||
gl.uniform2f(PIXI.primitiveProgram.projectionVector, 400, 300);
|
||||
// This could be speeded up fo sure!
|
||||
var m = PIXI.mat3.clone(graphics.worldTransform);
|
||||
|
||||
PIXI.mat3.transpose(m);
|
||||
|
||||
// set the matrix transform for the
|
||||
gl.uniformMatrix3fv(PIXI.primitiveProgram.translationMatrix, false, m);
|
||||
gl.uniform2f(PIXI.primitiveProgram.projectionVector, projection.x, projection.y);
|
||||
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, graphics._webGL.buffer);
|
||||
gl.vertexAttribPointer(PIXI.primitiveProgram.vertexPositionAttribute, 2, gl.FLOAT, false, 4 * 6, 0);
|
||||
gl.vertexAttribPointer(PIXI.primitiveProgram.colorAttribute, 4, gl.FLOAT, false,4 * 6, 2 * 4);
|
||||
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, graphics._webGL.glPoints.length/6);
|
||||
// set the index buffer!
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.indexBuffer);
|
||||
|
||||
gl.drawElements(gl.TRIANGLE_STRIP, graphics._webGL.indices.length, gl.UNSIGNED_SHORT, 0 );
|
||||
|
||||
// return to default shader...
|
||||
PIXI.activateDefaultShader();
|
||||
}
|
||||
|
||||
PIXI.WebGLGraphics.initGraphics = function(graphics)
|
||||
PIXI.WebGLGraphics.updateGraphics = function(graphics)
|
||||
{
|
||||
for (var i=graphics._webGL.lastIndex; i < graphics.graphicsData.length; i++)
|
||||
{
|
||||
|
@ -200,6 +211,12 @@ PIXI.WebGLGraphics.initGraphics = function(graphics)
|
|||
|
||||
if(data.type == PIXI.Graphics.POLY)
|
||||
{
|
||||
if(data.fill)
|
||||
{
|
||||
if(data.points.length>3)
|
||||
PIXI.WebGLGraphics.buildPoly(data, graphics._webGL);
|
||||
}
|
||||
|
||||
if(data.lineWidth > 0)
|
||||
{
|
||||
PIXI.WebGLGraphics.buildLine(data, graphics._webGL);
|
||||
|
@ -209,21 +226,24 @@ PIXI.WebGLGraphics.initGraphics = function(graphics)
|
|||
{
|
||||
PIXI.WebGLGraphics.buildRectangle(data, graphics._webGL);
|
||||
}
|
||||
else if(data.type == PIXI.Graphics.CIRC)
|
||||
else if(data.type == PIXI.Graphics.CIRC || data.type == PIXI.Graphics.ELIP)
|
||||
{
|
||||
PIXI.WebGLGraphics.buildCircle(data, graphics._webGL);
|
||||
}
|
||||
};
|
||||
|
||||
//console.log(graphics._webGL.lastIndex - graphics.graphicsData.length )
|
||||
graphics._webGL.lastIndex = graphics.graphicsData.length;
|
||||
|
||||
// convert to points
|
||||
graphics._webGL.glPoints = new Float32Array(graphics._webGL.points);
|
||||
|
||||
var gl = PIXI.gl;
|
||||
|
||||
graphics._webGL.glPoints = new Float32Array(graphics._webGL.points);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, graphics._webGL.buffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, graphics._webGL.glPoints, gl.STATIC_DRAW);
|
||||
|
||||
graphics._webGL.glIndicies = new Uint16Array(graphics._webGL.indices);
|
||||
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.indexBuffer);
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.glIndicies, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,16 +263,15 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
|||
{
|
||||
var color = HEXtoRGB(graphicsData.fillColor);
|
||||
var alpha = graphicsData.fillAlpha;
|
||||
|
||||
|
||||
var r = color[0] * alpha;
|
||||
var g = color[1] * alpha;
|
||||
var b = color[2] * alpha;
|
||||
|
||||
var verts = webGLData.points;
|
||||
|
||||
// dead triangle
|
||||
verts.push(webGLData.lastPosition.x, webGLData.lastPosition.y, 1, 1, 1, 1);
|
||||
verts.push(x, y, 1, 1, 1, 1);
|
||||
var indices = webGLData.indices;
|
||||
|
||||
var vertPos = verts.length/6;
|
||||
|
||||
// start
|
||||
verts.push(x, y);
|
||||
|
@ -267,8 +286,8 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
|||
verts.push(x + width, y + height);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
webGLData.lastPosition.x = x + width;
|
||||
webGLData.lastPosition.y = y + height;
|
||||
// insert 2 dead triangles..
|
||||
indices.push(vertPos, vertPos, vertPos+1, vertPos+2, vertPos+3, vertPos+3)
|
||||
}
|
||||
|
||||
if(graphicsData.lineWidth)
|
||||
|
@ -292,9 +311,10 @@ PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
|||
var rectData = graphicsData.points;
|
||||
var x = rectData[0];
|
||||
var y = rectData[1];
|
||||
var radius = rectData[2];
|
||||
var width = rectData[2];
|
||||
var height = rectData[3];
|
||||
|
||||
var totalSegs = 40
|
||||
var totalSegs = 40;
|
||||
var seg = (Math.PI * 2) / totalSegs ;
|
||||
|
||||
if(graphicsData.fill)
|
||||
|
@ -307,26 +327,24 @@ PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
|||
var b = color[2] * alpha;
|
||||
|
||||
var verts = webGLData.points;
|
||||
var indices = webGLData.indices;
|
||||
|
||||
var vecPos = verts.length/6;
|
||||
|
||||
verts.push(webGLData.lastPosition.x, webGLData.lastPosition.y, 1, 1, 1, 1);
|
||||
verts.push(x, y, 1, 1, 1, 1);
|
||||
indices.push(vecPos);
|
||||
|
||||
for (var i=0; i < totalSegs + 1 ; i++)
|
||||
{
|
||||
verts.push(x,y);
|
||||
verts.push(r, g, b, alpha);
|
||||
verts.push(x,y, r, g, b, alpha);
|
||||
|
||||
verts.push(x + Math.sin(seg * i) * radius,
|
||||
y + Math.cos(seg * i) * radius);
|
||||
verts.push(x + Math.sin(seg * i) * width,
|
||||
y + Math.cos(seg * i) * height,
|
||||
r, g, b, alpha);
|
||||
|
||||
verts.push(r, g, b, alpha);
|
||||
indices.push(vecPos++, vecPos++);
|
||||
};
|
||||
|
||||
verts.push(x,y);
|
||||
verts.push(1, 0, 0, 1);
|
||||
|
||||
webGLData.lastPosition.x = x;
|
||||
webGLData.lastPosition.y = y;
|
||||
indices.push(vecPos-1);
|
||||
}
|
||||
|
||||
if(graphicsData.lineWidth)
|
||||
|
@ -335,8 +353,8 @@ PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
|||
|
||||
for (var i=0; i < totalSegs + 1; i++)
|
||||
{
|
||||
graphicsData.points.push(x + Math.sin(seg * i) * radius,
|
||||
y + Math.cos(seg * i) * radius)
|
||||
graphicsData.points.push(x + Math.sin(seg * i) * width,
|
||||
y + Math.cos(seg * i) * height)
|
||||
};
|
||||
|
||||
PIXI.WebGLGraphics.buildLine(graphicsData, webGLData);
|
||||
|
@ -346,6 +364,8 @@ PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
|||
|
||||
PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
||||
{
|
||||
// TODO OPTIMISE!
|
||||
|
||||
var wrap = true;
|
||||
var points = graphicsData.points;
|
||||
if(points.length == 0)return;
|
||||
|
@ -370,118 +390,197 @@ PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
|||
}
|
||||
|
||||
var verts = webGLData.points;
|
||||
|
||||
var indices = webGLData.indices;
|
||||
var length = points.length / 2;
|
||||
var indexCount = points.length;
|
||||
var indexStart = verts.length/6;
|
||||
|
||||
// DRAW the Line
|
||||
var width = graphicsData.lineWidth / 2;
|
||||
|
||||
// sort color
|
||||
var color = HEXtoRGB(graphicsData.lineColor);
|
||||
var alpha = graphicsData.lineAlpha;
|
||||
var r = color[0] * alpha;
|
||||
var g = color[1] * alpha;
|
||||
var b = color[2] * alpha;
|
||||
|
||||
// i = 0 //
|
||||
var point1 = new PIXI.Point( points[0], points[1] );
|
||||
var point2 = new PIXI.Point( points[2], points[3] );
|
||||
var perp = getPerp(point1, point2);
|
||||
var dist = Math.sqrt(perp.x*perp.x + perp.y*perp.y);
|
||||
var p1x, p1y, p2x, p2y, p3x, p3y;
|
||||
var perpx, perpy, perp2x, perp2y, perp3x, perp3y;
|
||||
var ipx, ipy;
|
||||
var a1, b1, c1, a2, b2, c2;
|
||||
var denom, pdist, dist;
|
||||
|
||||
perp.x /= dist;
|
||||
perp.y /= dist;
|
||||
perp.x *= width;
|
||||
perp.y *= width;
|
||||
p1x = points[0];
|
||||
p1y = points[1];
|
||||
|
||||
// insert dead triangle!
|
||||
verts.push(webGLData.lastPosition.x, webGLData.lastPosition.y, 1, 1, 1, 1);
|
||||
verts.push(points[0] - perp.x , points[1] - perp.y, 1, 1, 1, 1);
|
||||
p2x = points[2];
|
||||
p2y = points[3];
|
||||
|
||||
perpx = -(p1y - p2y);
|
||||
perpy = p1x - p2x;
|
||||
|
||||
dist = Math.sqrt(perpx*perpx + perpy*perpy);
|
||||
|
||||
perpx /= dist;
|
||||
perpy /= dist;
|
||||
perpx *= width;
|
||||
perpy *= width;
|
||||
|
||||
// start
|
||||
verts.push(points[0] - perp.x , points[1] - perp.y);
|
||||
verts.push(r, g, b, alpha);
|
||||
verts.push(p1x - perpx , p1y - perpy,
|
||||
r, g, b, alpha);
|
||||
|
||||
verts.push(points[0] + perp.x , points[1] + perp.y);
|
||||
verts.push(r, g, b, alpha);
|
||||
verts.push(p1x + perpx , p1y + perpy,
|
||||
r, g, b, alpha);
|
||||
|
||||
for (var i = 1; i < length-1; i++)
|
||||
{
|
||||
var point1 = new PIXI.Point( points[(i-1)*2],points[(i-1)*2 + 1] );
|
||||
var point2 = new PIXI.Point(points[(i)*2],points[(i)*2 + 1] );
|
||||
var point3 = new PIXI.Point(points[(i+1)*2],points[(i+1)*2 + 1] );
|
||||
p1x = points[(i-1)*2];
|
||||
p1y = points[(i-1)*2 + 1];
|
||||
|
||||
var perp = getPerp(point1, point2);
|
||||
var dist = Math.sqrt(perp.x*perp.x + perp.y*perp.y);
|
||||
perp.x /= dist;
|
||||
perp.y /= dist;
|
||||
perp.x *= width;
|
||||
perp.y *= width;
|
||||
p2x = points[(i)*2]
|
||||
p2y = points[(i)*2 + 1]
|
||||
|
||||
p3x = points[(i+1)*2];
|
||||
p3y = points[(i+1)*2 + 1];
|
||||
|
||||
perpx = -(p1y - p2y);
|
||||
perpy = p1x - p2x;
|
||||
|
||||
dist = Math.sqrt(perpx*perpx + perpy*perpy);
|
||||
perpx /= dist;
|
||||
perpy /= dist;
|
||||
perpx *= width;
|
||||
perpy *= width;
|
||||
|
||||
var perp2 = getPerp(point2, point3);
|
||||
var dist2 = Math.sqrt(perp2.x*perp2.x + perp2.y*perp2.y);
|
||||
perp2.x /= dist2;
|
||||
perp2.y /= dist2;
|
||||
perp2.x *= width;
|
||||
perp2.y *= width;
|
||||
perp2x = -(p2y - p3y);
|
||||
perp2y = p2x - p3x;
|
||||
|
||||
var p1 = new PIXI.Point(-perp.x+ point2.x , -perp.y+point2.y);
|
||||
var p1_ = new PIXI.Point(-perp.x+ point1.x, -perp.y+point1.y);
|
||||
dist = Math.sqrt(perp2x*perp2x + perp2y*perp2y);
|
||||
perp2x /= dist;
|
||||
perp2y /= dist;
|
||||
perp2x *= width;
|
||||
perp2y *= width;
|
||||
|
||||
var p2 = new PIXI.Point(-perp2.x+ point2.x , -perp2.y+point2.y );
|
||||
var p2_ = new PIXI.Point(-perp2.x+ point3.x , -perp2.y+point3.y );
|
||||
a1 = (-perpy + p1y) - (-perpy + p2y);
|
||||
b1 = (-perpx + p2x) - (-perpx + p1x);
|
||||
c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y);
|
||||
a2 = (-perp2y + p3y) - (-perp2y + p2y);
|
||||
b2 = (-perp2x + p2x) - (-perp2x + p3x);
|
||||
c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y);
|
||||
|
||||
denom = a1*b2 - a2*b1;
|
||||
|
||||
if (denom == 0) {
|
||||
denom+=1;
|
||||
}
|
||||
|
||||
px = (b1*c2 - b2*c1)/denom;
|
||||
py = (a2*c1 - a1*c2)/denom;
|
||||
|
||||
var p = lineIntersectLine(p1, p1_, p2, p2_);
|
||||
|
||||
var pdist = (p.x -point2.x) * (p.x -point2.x) + (p.y -point2.y) + (p.y -point2.y);
|
||||
pdist = (px -p2x) * (px -p2x) + (py -p2y) + (py -p2y);
|
||||
|
||||
if(pdist > 140 * 140)
|
||||
{
|
||||
var perp3 = new PIXI.Point(perp.x - perp2.x, perp.y - perp2.y);
|
||||
var dist3 = Math.sqrt(perp3.x*perp3.x + perp3.y*perp3.y);
|
||||
perp3.x /= dist3;
|
||||
perp3.y /= dist3;
|
||||
perp3.x *= width;
|
||||
perp3.y *= width;
|
||||
perp3x = perpx - perp2x;
|
||||
perp3y = perpy - perp2y;
|
||||
|
||||
verts.push(point2.x - perp3.x, point2.y -perp3.y);
|
||||
dist = Math.sqrt(perp3x*perp3x + perp3y*perp3y);
|
||||
perp3x /= dist;
|
||||
perp3y /= dist;
|
||||
perp3x *= width;
|
||||
perp3y *= width;
|
||||
|
||||
verts.push(p2x - perp3x, p2y -perp3y);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
verts.push(point2.x + perp3.x, point2.y +perp3.y);
|
||||
|
||||
verts.push(p2x + perp3x, p2y +perp3y);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
verts.push(point2.x - perp3.x, point2.y -perp3.y);
|
||||
|
||||
verts.push(p2x - perp3x, p2y -perp3y);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
indexCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
verts.push(p.x , p.y);
|
||||
verts.push(px , py);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
verts.push(point2.x - (p.x-point2.x), point2.y - (p.y - point2.y));//, 4);
|
||||
|
||||
verts.push(p2x - (px-p2x), p2y - (py - p2y));//, 4);
|
||||
verts.push(r, g, b, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
var point1 = new PIXI.Point( points[(length-2)*2], points[(length-2)*2 + 1] );
|
||||
var point2 = new PIXI.Point( points[(length-1)*2], points[(length-1)*2 + 1] );
|
||||
p1x = points[(length-2)*2]
|
||||
p1y = points[(length-2)*2 + 1]
|
||||
|
||||
var perp = getPerp(point1, point2);
|
||||
var dist = Math.sqrt(perp.x*perp.x + perp.y*perp.y);
|
||||
perp.x /= dist;
|
||||
perp.y /= dist;
|
||||
perp.x *= width;
|
||||
perp.y *= width;
|
||||
verts.push(point2.x - perp.x , point2.y - perp.y)
|
||||
p2x = points[(length-1)*2]
|
||||
p2y = points[(length-1)*2 + 1]
|
||||
|
||||
perpx = -(p1y - p2y)
|
||||
perpy = p1x - p2x;
|
||||
|
||||
dist = Math.sqrt(perpx*perpx + perpy*perpy);
|
||||
perpx /= dist;
|
||||
perpy /= dist;
|
||||
perpx *= width;
|
||||
perpy *= width;
|
||||
|
||||
verts.push(p2x - perpx , p2y - perpy)
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
verts.push(point2.x + perp.x , point2.y + perp.y)
|
||||
verts.push(p2x + perpx , p2y + perpy)
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
// set last triangle!
|
||||
webGLData.lastPosition.x = point2.x + perp.x;
|
||||
webGLData.lastPosition.y = point2.y + perp.y;
|
||||
indices.push(indexStart);
|
||||
|
||||
for (var i=0; i < indexCount; i++)
|
||||
{
|
||||
indices.push(indexStart++);
|
||||
};
|
||||
|
||||
indices.push(indexStart-1);
|
||||
}
|
||||
|
||||
|
||||
PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
|
||||
{
|
||||
var points = graphicsData.points;
|
||||
if(points.length < 6)return;
|
||||
|
||||
// get first and last point.. figure out the middle!
|
||||
var verts = webGLData.points;
|
||||
var indices = webGLData.indices;
|
||||
|
||||
var length = points.length / 2;
|
||||
|
||||
// sort color
|
||||
var color = HEXtoRGB(graphicsData.fillColor);
|
||||
var alpha = graphicsData.fillAlpha;
|
||||
var r = color[0] * alpha;
|
||||
var g = color[1] * alpha;
|
||||
var b = color[2] * alpha;
|
||||
|
||||
var triangles = PIXI.PolyK.Triangulate(points);
|
||||
|
||||
var vertPos = verts.length / 6;
|
||||
|
||||
for (var i=0; i < triangles.length; i+=3)
|
||||
{
|
||||
indices.push(triangles[i] + vertPos);
|
||||
indices.push(triangles[i] + vertPos);
|
||||
indices.push(triangles[i+1] + vertPos);
|
||||
indices.push(triangles[i+2] +vertPos);
|
||||
indices.push(triangles[i+2] + vertPos);
|
||||
};
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
verts.push(points[i * 2], points[i * 2 + 1],
|
||||
r, g, b, alpha);
|
||||
};
|
||||
}
|
||||
|
||||
function HEXtoRGB(hex) {
|
||||
|
@ -489,47 +588,6 @@ function HEXtoRGB(hex) {
|
|||
}
|
||||
|
||||
|
||||
function normalise(point)
|
||||
{
|
||||
var dist = Math.sqrt(point.x * point.x + point.y * point.y);
|
||||
return new PIXI.Point(point.x / dist, point.y / dist);
|
||||
}
|
||||
|
||||
function getPerp(point, point2)
|
||||
{
|
||||
return new PIXI.Point(-(point.y - point2.y), point.x - point2.x);
|
||||
}
|
||||
|
||||
function lineIntersectLine(A,B,E,F)
|
||||
{
|
||||
var ip;
|
||||
var a1;
|
||||
var a2;
|
||||
var b1;
|
||||
var b2;
|
||||
var c1;
|
||||
var c2;
|
||||
|
||||
a1= B.y-A.y;
|
||||
b1= A.x-B.x;
|
||||
c1= B.x*A.y - A.x*B.y;
|
||||
a2= F.y-E.y;
|
||||
b2= E.x-F.x;
|
||||
c2= F.x*E.y - E.x*F.y;
|
||||
|
||||
var denom=a1*b2 - a2*b1;
|
||||
|
||||
if (denom == 0) {
|
||||
// return null;
|
||||
console.log("!")
|
||||
denom+=1;
|
||||
}
|
||||
ip=new PIXI.Point();
|
||||
ip.x=(b1*c2 - b2*c1)/denom;
|
||||
ip.y=(a2*c1 - a1*c2)/denom;
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue