Determine where the input $source argument is a callback function, a set
of arrays, or neither. If $source is a callback function, run it through
the functionToPoints() method with the input $args, and set $points to
output array. If $source is a set of arrays, simply set $points to
$source. If $source is neither, throw an Exception.
public static getSplinePoints ( $source, array $args = [] ) : array | ||
$source | The source of our approximation. Should be either a callback function or a set of arrays. | |
$args | array | The arguments of our callback function: derivative, start, end, and n. Example: [$derivative, 0, 8, 5]. If $source is a set of arrays, $args will default to []. |
리턴 | array |
public function testIncorrectInput() { // The input $source is neither a callback or a set of arrays $this->setExpectedException('MathPHP\\Exception\\BadDataException'); $x = 10; $incorrectFunction = $x ** 2 + 2 * $x + 1; ClampedCubicSpline::getSplinePoints($incorrectFunction, [0, 4, 5]); }