mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Added Line.Offset, Triangle.Offset and Triangle.Equals.
This commit is contained in:
parent
b3bced081a
commit
7bcdf669b8
5 changed files with 44 additions and 0 deletions
12
v3/src/geom/line/Offset.js
Normal file
12
v3/src/geom/line/Offset.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
var Offset = function (line, x, y)
|
||||
{
|
||||
line.x1 += x;
|
||||
line.y1 += y;
|
||||
|
||||
line.x2 += x;
|
||||
line.y2 += y;
|
||||
|
||||
return line;
|
||||
};
|
||||
|
||||
module.exports = Offset;
|
|
@ -15,6 +15,7 @@ Line.Length = require('./Length');
|
|||
Line.NormalAngle = require('./NormalAngle');
|
||||
Line.NormalX = require('./NormalX');
|
||||
Line.NormalY = require('./NormalY');
|
||||
Line.Offset = require('./Offset');
|
||||
Line.PerpSlope = require('./PerpSlope');
|
||||
Line.Random = require('./Random');
|
||||
Line.ReflectAngle = require('./ReflectAngle');
|
||||
|
|
13
v3/src/geom/triangle/Equals.js
Normal file
13
v3/src/geom/triangle/Equals.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Equals = function (triangle, toCompare)
|
||||
{
|
||||
return (
|
||||
triangle.x1 === toCompare.x1 &&
|
||||
triangle.y1 === toCompare.y1 &&
|
||||
triangle.x2 === toCompare.x2 &&
|
||||
triangle.y2 === toCompare.y2 &&
|
||||
triangle.x3 === toCompare.x3 &&
|
||||
triangle.y3 === toCompare.y3
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = Equals;
|
15
v3/src/geom/triangle/Offset.js
Normal file
15
v3/src/geom/triangle/Offset.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
var Offset = function (triangle, x, y)
|
||||
{
|
||||
triangle.x1 += x;
|
||||
triangle.y1 += y;
|
||||
|
||||
triangle.x2 += x;
|
||||
triangle.y2 += y;
|
||||
|
||||
triangle.x3 += x;
|
||||
triangle.y3 += y;
|
||||
|
||||
return triangle;
|
||||
};
|
||||
|
||||
module.exports = Offset;
|
|
@ -11,7 +11,10 @@ Triangle.CircumCircle = require('./CircumCircle');
|
|||
Triangle.Clone = require('./Clone');
|
||||
Triangle.Contains = require('./Contains');
|
||||
Triangle.ContainsPoint = require('./ContainsPoint');
|
||||
Triangle.CopyFrom = require('./CopyFrom');
|
||||
Triangle.Equals = require('./Equals');
|
||||
Triangle.InCenter = require('./InCenter');
|
||||
Triangle.Offset = require('./Offset');
|
||||
Triangle.Random = require('./Random');
|
||||
Triangle.Rotate = require('./Rotate');
|
||||
Triangle.RotateAroundPoint = require('./RotateAroundPoint');
|
||||
|
|
Loading…
Reference in a new issue