import { minError } from "@thi.ng/math/min-error" ; import type { ReadonlyVec , Vec } from "@thi.ng/vectors" ; import { distSq } from "@thi.ng/vectors/distsq" ; import { mixQuadratic } from "@thi.ng/vectors/mix-quadratic" ; /**
 * Performs recursive search for closest point to `p` on quadratic curve
 * defined by control points `a`,`b`,`c`. The `res` and `recur` params
 * are used to control the recursion behavior. If `eps` is given, the
 * search is terminated as soon as a point with a shorter *squared*
 * distance than `eps` is found.
 *
 *  {@link @thi.ng/math#minError} param p param a param b param c param res param iter param eps export const closestPointQuadratic = ( p , a , b , c , out = [ ] , res ? , iter ? , eps ? ) => { const fn = ( t ) => mixQuadratic ( out , a , b , c , t ) ; return fn ( minError ( fn , distSq , p , res , iter , 0 , 1 , eps ) ) ; } ;