Méthode | Description | |
---|---|---|
approximate ( $source, $args ) | ||
getPoints ( $source, array $args = [] ) : array | 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. | |
validate ( array $points, number $degree = 2 ) : boolean | Validate that there are enough input arrays (points), that each point array has precisely two numbers, and that no two points share the same first number (x-component) |
Méthode | Description | |
---|---|---|
functionToPoints ( callable $function, number $start, number $end, number $n ) : array | Evaluate our callback function at n evenly spaced points on the interval between start and end | |
sort ( array $points ) : array | Sorts our coordinates (arrays) by their x-component (first number) such that consecutive coordinates have an increasing x-component. |
public static getPoints ( $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: start, end, and n. Example: [0, 8, 5]. If $source is a set of arrays, $args will default to []. |
Résultat | array |