import type { CurvePiece } from '../mat/curve-piece.js'; import type { FootAndEndpointInfo } from './foot-and-endpoint-info.js'; import type { PrePointOnShape } from '../point-on-shape/point-on-shape.js'; import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js'; import { cullCurvePieces1 } from './cull-bezier-pieces-1.js'; import { toP } from '../point-on-shape/to-p.js'; /** * Returns the closest boundary point to the given point, limited to the given * bezier pieces, including the beziers actually checked after culling. * * @param maxCoordPowerOf2 * @param curvePieces * @param x * * @internal */ function getCloseBoundaryPointsCertified( curvePieces: CurvePiece[], x: number[]): PrePointOnShape[] { curvePieces = cullCurvePieces1(curvePieces, x); const pInfos: FootAndEndpointInfo[] = []; for (let i=0; i { const { curve, t } = info; const { ps } = curve; const pDd = toP(ps, t); const p = pDd.map(c => c[0] + c[1]) return { curve, t, isSource: false, p, pDd }; }); } export { getCloseBoundaryPointsCertified };