eval-de-casteljau-error
function evalDeCasteljauError(ps: number[][], t: number[]): number[]
Defined in local-properties-at-t/evaluate/eval-de-casteljau-error.ts:70
Returns a representation of the error (from which an absolute error bound
can be calculated) when evaluating the given bezier curve at the parameter t
using De Casteljau's algorithm.
The returned error representation needs to be multiplied with
Stewart error counters¹
and an appropriate error function, γ, depending on the precision used (e.g. double
or double-double). This is explained in more detail below. See
also Higham 2002
p. 68 near the bottom.
(1) G. W. Stewart. Introduction to Matrix Computations. Academic Press, New York, 1973. xiii+441 pp. ISBN 0-12-670350-7
The absolute erros below can be calculated as follows (where <E> are the
error counters as indicated in the comments of the return value below):
- double precision:
<E> * (γ(1)) * result_ - double-double precision:
<E> * (2*γγ(3)) * result_
where [[γ]] and [[γγ]] are the usual error functions with γ(1) === 1.1102230246251568e-16
and γγ(3) === 3.697785493223493e-32.
The T in the error counter formula is the input error given as an error
counter on t. For example, if the exact t (let's call it te) is bounded
by (|t| - 5u) < |te| < (|t| + 5u) where u === Number.EPSILON/2 then T
should be given as 5. If t is exact then T is zero.
// for cubic bezier curves
return [
x_, // <E> === 3T + 9
y_ // <E> === 3T + 9
];
// for quadratic bezier curves
return [
x_, // <E> === 2T + 6
y_ // <E> === 2T + 6
];
// for linear bezier curves (i.e. lines)
return [
x_, // <E> === T + 3
y_ // <E> === T + 3
];
Parameters:
| Name | Type | Description |
|---|---|---|
ps | number[][] | an order 0,1,2 or 3 bezier curve given by an ordered array of its control points, e.g. [[0,0],[1,1],[2,1],[2,0]] |
t | number[] | the parameter value where the bezier should be evaluated (given in double-double precision) |