UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.

26 lines (22 loc) 679 B
/** * @author Richard Davey <rich@phaser.io> * @copyright 2013-2025 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var Factorial = require('./Factorial'); /** * Calculates the Bernstein basis from the three factorial coefficients. * * @function Phaser.Math.Bernstein * @since 3.0.0 * * @param {number} n - The first value. * @param {number} i - The second value. * * @return {number} The Bernstein basis of Factorial(n) / Factorial(i) / Factorial(n - i) */ var Bernstein = function (n, i) { return Factorial(n) / Factorial(i) / Factorial(n - i); }; module.exports = Bernstein;