2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2023-01-02 17:36:27 +00:00
|
|
|
* @copyright 2013-2023 Photon Storm Ltd.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-02-12 16:01:20 +00:00
|
|
|
*/
|
|
|
|
|
2018-02-07 21:58:23 +00:00
|
|
|
var CONST = require('./const');
|
|
|
|
var Extend = require('../utils/object/Extend');
|
2017-09-22 00:34:30 +00:00
|
|
|
|
2018-01-31 13:54:44 +00:00
|
|
|
/**
|
|
|
|
* @namespace Phaser.Math
|
|
|
|
*/
|
|
|
|
|
2018-02-07 21:58:23 +00:00
|
|
|
var PhaserMath = {
|
2017-09-22 00:34:30 +00:00
|
|
|
|
2017-09-13 16:09:16 +00:00
|
|
|
// Collections of functions
|
|
|
|
Angle: require('./angle/'),
|
|
|
|
Distance: require('./distance/'),
|
|
|
|
Easing: require('./easing/'),
|
|
|
|
Fuzzy: require('./fuzzy/'),
|
|
|
|
Interpolation: require('./interpolation/'),
|
|
|
|
Pow2: require('./pow2/'),
|
|
|
|
Snap: require('./snap/'),
|
|
|
|
|
2018-04-16 15:07:52 +00:00
|
|
|
// Expose the RNG Class
|
|
|
|
RandomDataGenerator: require('./random-data-generator/RandomDataGenerator'),
|
|
|
|
|
2017-09-13 16:09:16 +00:00
|
|
|
// Single functions
|
|
|
|
Average: require('./Average'),
|
|
|
|
Bernstein: require('./Bernstein'),
|
|
|
|
Between: require('./Between'),
|
|
|
|
CatmullRom: require('./CatmullRom'),
|
2016-12-13 16:12:25 +00:00
|
|
|
CeilTo: require('./CeilTo'),
|
|
|
|
Clamp: require('./Clamp'),
|
|
|
|
DegToRad: require('./DegToRad'),
|
|
|
|
Difference: require('./Difference'),
|
2020-09-30 10:02:54 +00:00
|
|
|
Euler: require('./Euler'),
|
2016-12-13 16:12:25 +00:00
|
|
|
Factorial: require('./Factorial'),
|
|
|
|
FloatBetween: require('./FloatBetween'),
|
|
|
|
FloorTo: require('./FloorTo'),
|
2017-10-17 20:32:00 +00:00
|
|
|
FromPercent: require('./FromPercent'),
|
2017-04-27 16:03:19 +00:00
|
|
|
GetSpeed: require('./GetSpeed'),
|
2017-06-27 22:23:09 +00:00
|
|
|
IsEven: require('./IsEven'),
|
|
|
|
IsEvenStrict: require('./IsEvenStrict'),
|
2016-12-13 16:12:25 +00:00
|
|
|
Linear: require('./Linear'),
|
2021-10-10 13:46:10 +00:00
|
|
|
LinearXY: require('./LinearXY'),
|
2016-12-13 16:12:25 +00:00
|
|
|
MaxAdd: require('./MaxAdd'),
|
2021-03-25 14:42:22 +00:00
|
|
|
Median: require('./Median'),
|
2016-12-13 16:12:25 +00:00
|
|
|
MinSub: require('./MinSub'),
|
|
|
|
Percent: require('./Percent'),
|
|
|
|
RadToDeg: require('./RadToDeg'),
|
2017-09-18 20:48:26 +00:00
|
|
|
RandomXY: require('./RandomXY'),
|
|
|
|
RandomXYZ: require('./RandomXYZ'),
|
|
|
|
RandomXYZW: require('./RandomXYZW'),
|
2016-12-13 16:12:25 +00:00
|
|
|
Rotate: require('./Rotate'),
|
|
|
|
RotateAround: require('./RotateAround'),
|
2017-01-03 22:47:26 +00:00
|
|
|
RotateAroundDistance: require('./RotateAroundDistance'),
|
2020-04-24 20:26:42 +00:00
|
|
|
RotateTo: require('./RotateTo'),
|
2016-12-13 16:12:25 +00:00
|
|
|
RoundAwayFromZero: require('./RoundAwayFromZero'),
|
|
|
|
RoundTo: require('./RoundTo'),
|
|
|
|
SinCosTableGenerator: require('./SinCosTableGenerator'),
|
|
|
|
SmootherStep: require('./SmootherStep'),
|
|
|
|
SmoothStep: require('./SmoothStep'),
|
2019-06-25 15:57:05 +00:00
|
|
|
ToXY: require('./ToXY'),
|
2018-01-04 15:21:15 +00:00
|
|
|
TransformXY: require('./TransformXY'),
|
2016-12-13 16:12:25 +00:00
|
|
|
Within: require('./Within'),
|
2017-09-15 15:31:48 +00:00
|
|
|
Wrap: require('./Wrap'),
|
|
|
|
|
|
|
|
// Vector classes
|
|
|
|
Vector2: require('./Vector2'),
|
|
|
|
Vector3: require('./Vector3'),
|
|
|
|
Vector4: require('./Vector4'),
|
|
|
|
Matrix3: require('./Matrix3'),
|
|
|
|
Matrix4: require('./Matrix4'),
|
2017-09-16 01:31:33 +00:00
|
|
|
Quaternion: require('./Quaternion'),
|
|
|
|
RotateVec3: require('./RotateVec3')
|
2016-12-13 16:12:25 +00:00
|
|
|
|
|
|
|
};
|
2018-02-07 21:58:23 +00:00
|
|
|
|
|
|
|
// Merge in the consts
|
|
|
|
|
|
|
|
PhaserMath = Extend(false, PhaserMath, CONST);
|
|
|
|
|
|
|
|
// Export it
|
|
|
|
|
|
|
|
module.exports = PhaserMath;
|