Added Line Clone, CopyFrom and Equals and fixed some build errors.

This commit is contained in:
Richard Davey 2017-01-05 00:20:11 +00:00
parent 1deac35550
commit fa14825473
8 changed files with 64 additions and 4 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '20cbbc80-c7e5-11e6-b229-2d3070a0413b'
build: 'a9e8c060-d2dc-11e6-8d87-49514174f937'
};
module.exports = CHECKSUM;

View file

@ -11,9 +11,9 @@ Circle.ContainsPoint = require('./ContainsPoint');
Circle.ContainsRect = require('./ContainsRect');
Circle.CopyFrom = require('./CopyFrom');
Circle.Equals = require('./Equals');
Circle.GetBounds = require('./GetBounds');
Circle.Offset = require('./Offset');
Circle.OffsetPoint = require('./OffsetPoint');
Circle.Overlaps = require('./Overlaps');
Circle.Random = require('./Random');
module.exports = Circle;

View file

@ -5,6 +5,7 @@ module.exports = {
Circle: require('./circle'),
Ellipse: require('./ellipse'),
Intersects: require('./intersects'),
Line: require('./line'),
Point: require('./point'),
Rectangle: require('./rectangle')

View file

@ -1,11 +1,11 @@
var Rectangle = require('../rectangle/Rectangle');
var RectangleVsRectangle = require('./RectangleVsRectangle');
var RectangleToRectangle = require('./RectangleToRectangle');
var GetRectangleIntersection = function (rectA, rectB, output)
{
if (output === undefined) { output = new Rectangle(); }
if (RectangleVsRectangle(rectA, rectB))
if (RectangleToRectangle(rectA, rectB))
{
output.x = Math.max(rectA.x, rectB.x);
output.y = Math.max(rectA.y, rectB.y);

View file

@ -0,0 +1,8 @@
var Line = require('./Line');
var Clone = function (source)
{
return new Line(source.x1, source.y1, source.x2, source.y2);
};
module.exports = Clone;

View file

@ -0,0 +1,12 @@
/**
* Copies the x, y and diameter properties from any given object to this Circle.
* @method Phaser.Circle#copyFrom
* @param {any} source - The object to copy from.
* @return {Circle} This Circle object.
*/
var CopyFrom = function (source, dest)
{
return dest.setTo(source.x1, source.y1, source.x2, source.y2);
};
module.exports = CopyFrom;

View file

@ -0,0 +1,11 @@
var Equals = function (line, toCompare)
{
return (
line.x1 === toCompare.x1 &&
line.y1 === toCompare.y1 &&
line.x2 === toCompare.x2 &&
line.y2 === toCompare.y2
);
};
module.exports = Equals;

28
v3/src/geom/line/index.js Normal file
View file

@ -0,0 +1,28 @@
// Phaser.Geom.Line
var Line = require('./Line');
Line.Angle = require('./Angle');
Line.CenterOn = require('./CenterOn');
Line.Clone = require('./Clone');
Line.CopyFrom = require('./CopyFrom');
Line.Equals = require('./Equals');
Line.GetMidPoint = require('./GetMidPoint');
Line.GetNormal = require('./GetNormal');
Line.GetPointsOnLine = require('./GetPointsOnLine');
Line.Height = require('./Height');
Line.Length = require('./Length');
Line.NormalAngle = require('./NormalAngle');
Line.NormalX = require('./NormalX');
Line.NormalY = require('./NormalY');
Line.PerpSlope = require('./PerpSlope');
Line.Random = require('./Random');
Line.ReflectAngle = require('./ReflectAngle');
Line.Rotate = require('./Rotate');
Line.RotateAroundPoint = require('./RotateAroundPoint');
Line.RotateAroundXY = require('./RotateAroundXY');
Line.SetToAngle = require('./SetToAngle');
Line.Slope = require('./Slope');
Line.Width = require('./Width');
module.exports = Line;