mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Documented Math.Distance, Math.Fuzzy and Math.Interpolation.
This commit is contained in:
parent
d6d9b69897
commit
0f9bfc62f8
13 changed files with 64 additions and 64 deletions
|
@ -5,17 +5,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Calculate the distance between two sets of coordinates (points).
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Distance.Between
|
* @function Phaser.Math.Distance.Between
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} x1 - [description]
|
* @param {number} x1 - The x coordinate of the first point.
|
||||||
* @param {number} y1 - [description]
|
* @param {number} y1 - The y coordinate of the first point.
|
||||||
* @param {number} x2 - [description]
|
* @param {number} x2 - The x coordinate of the second point.
|
||||||
* @param {number} y2 - [description]
|
* @param {number} y2 - The y coordinate of the second point.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The distance between each point.
|
||||||
*/
|
*/
|
||||||
var DistanceBetween = function (x1, y1, x2, y2)
|
var DistanceBetween = function (x1, y1, x2, y2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Calculate the distance between two sets of coordinates (points) to the power of `pow`.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Distance.Power
|
* @function Phaser.Math.Distance.Power
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} x1 - [description]
|
* @param {number} x1 - The x coordinate of the first point.
|
||||||
* @param {number} y1 - [description]
|
* @param {number} y1 - The y coordinate of the first point.
|
||||||
* @param {number} x2 - [description]
|
* @param {number} x2 - The x coordinate of the second point.
|
||||||
* @param {number} y2 - [description]
|
* @param {number} y2 - The y coordinate of the second point.
|
||||||
* @param {number} pow - [description]
|
* @param {number} pow - The exponent.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The distance between each point.
|
||||||
*/
|
*/
|
||||||
var DistancePower = function (x1, y1, x2, y2, pow)
|
var DistancePower = function (x1, y1, x2, y2, pow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Calculate the distance between two sets of coordinates (points), squared.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Distance.Squared
|
* @function Phaser.Math.Distance.Squared
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} x1 - [description]
|
* @param {number} x1 - The x coordinate of the first point.
|
||||||
* @param {number} y1 - [description]
|
* @param {number} y1 - The y coordinate of the first point.
|
||||||
* @param {number} x2 - [description]
|
* @param {number} x2 - The x coordinate of the second point.
|
||||||
* @param {number} y2 - [description]
|
* @param {number} y2 - The y coordinate of the second point.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The distance between each point, squared.
|
||||||
*/
|
*/
|
||||||
var DistanceSquared = function (x1, y1, x2, y2)
|
var DistanceSquared = function (x1, y1, x2, y2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Calculate the ceiling of the given value.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Fuzzy.Ceil
|
* @function Phaser.Math.Fuzzy.Ceil
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} value - [description]
|
* @param {number} value - The value.
|
||||||
* @param {float} [epsilon=0.0001] - [description]
|
* @param {float} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The ceiling of the value.
|
||||||
*/
|
*/
|
||||||
var Ceil = function (value, epsilon)
|
var Ceil = function (value, epsilon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether the given values are equal.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Fuzzy.Equal
|
* @function Phaser.Math.Fuzzy.Equal
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} a - [description]
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - [description]
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - [description]
|
* @param {float} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} Whether the given values are equal.
|
||||||
*/
|
*/
|
||||||
var Equal = function (a, b, epsilon)
|
var Equal = function (a, b, epsilon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Calculate the floor of the given value.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Fuzzy.Floor
|
* @function Phaser.Math.Fuzzy.Floor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} value - [description]
|
* @param {number} value - The value.
|
||||||
* @param {float} [epsilon=0.0001] - [description]
|
* @param {float} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The floor of the value.
|
||||||
*/
|
*/
|
||||||
var Floor = function (value, epsilon)
|
var Floor = function (value, epsilon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether `a` is greater than `b`.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Fuzzy.GreaterThan
|
* @function Phaser.Math.Fuzzy.GreaterThan
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} a - [description]
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - [description]
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - [description]
|
* @param {float} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} Whether `a` is greater than `b`.
|
||||||
*/
|
*/
|
||||||
var GreaterThan = function (a, b, epsilon)
|
var GreaterThan = function (a, b, epsilon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether `a` is less than `b`.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Fuzzy.LessThan
|
* @function Phaser.Math.Fuzzy.LessThan
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} a - [description]
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - [description]
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - [description]
|
* @param {float} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} Whether `a` is less than `b`.
|
||||||
*/
|
*/
|
||||||
var LessThan = function (a, b, epsilon)
|
var LessThan = function (a, b, epsilon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
var Bernstein = require('../Bernstein');
|
var Bernstein = require('../Bernstein');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* A bezier interpolation method.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Interpolation.Bezier
|
* @function Phaser.Math.Interpolation.Bezier
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} v - [description]
|
* @param {number[]} v - The input array of values to interpolate between.
|
||||||
* @param {number} k - [description]
|
* @param {number} k - The percentage of interpolation, between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The interpolated value.
|
||||||
*/
|
*/
|
||||||
var BezierInterpolation = function (v, k)
|
var BezierInterpolation = function (v, k)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
var CatmullRom = require('../CatmullRom');
|
var CatmullRom = require('../CatmullRom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* A Catmull-Rom interpolation method.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Interpolation.CatmullRom
|
* @function Phaser.Math.Interpolation.CatmullRom
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} v - [description]
|
* @param {number[]} v - The input array of values to interpolate between.
|
||||||
* @param {number} k - [description]
|
* @param {number} k - The percentage of interpolation, between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The interpolated value.
|
||||||
*/
|
*/
|
||||||
var CatmullRomInterpolation = function (v, k)
|
var CatmullRomInterpolation = function (v, k)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,18 +36,18 @@ function P3 (t, p)
|
||||||
// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a
|
// https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* A cubic bezier interpolation method.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Interpolation.CubicBezier
|
* @function Phaser.Math.Interpolation.CubicBezier
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} t - [description]
|
* @param {float} t - The percentage of interpolation, between 0 and 1.
|
||||||
* @param {number} p0 - [description]
|
* @param {number} p0 - The start point.
|
||||||
* @param {number} p1 - [description]
|
* @param {number} p1 - The first control point.
|
||||||
* @param {number} p2 - [description]
|
* @param {number} p2 - The second control point.
|
||||||
* @param {number} p3 - [description]
|
* @param {number} p3 - The end point.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The interpolated value.
|
||||||
*/
|
*/
|
||||||
var CubicBezierInterpolation = function (t, p0, p1, p2, p3)
|
var CubicBezierInterpolation = function (t, p0, p1, p2, p3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
var Linear = require('../Linear');
|
var Linear = require('../Linear');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Linear Interpolation Method.
|
* A linear interpolation method.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Interpolation.Linear
|
* @function Phaser.Math.Interpolation.Linear
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
|
|
@ -28,17 +28,17 @@ function P2 (t, p)
|
||||||
// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js
|
// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* A quadratic bezier interpolation method.
|
||||||
*
|
*
|
||||||
* @function Phaser.Math.Interpolation.QuadraticBezier
|
* @function Phaser.Math.Interpolation.QuadraticBezier
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {float} t - [description]
|
* @param {float} t - The percentage of interpolation, between 0 and 1.
|
||||||
* @param {number} p0 - [description]
|
* @param {number} p0 - The start point.
|
||||||
* @param {number} p1 - [description]
|
* @param {number} p1 - The control point.
|
||||||
* @param {number} p2 - [description]
|
* @param {number} p2 - The end point.
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} The interpolated value.
|
||||||
*/
|
*/
|
||||||
var QuadraticBezierInterpolation = function (t, p0, p1, p2)
|
var QuadraticBezierInterpolation = function (t, p0, p1, p2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue