Skip to main content

get-medial-points

function getMedialPoints(p: number[], v: number[], ps: number[][]): { ts: number[]; ss: number[]; qs: number[][]; }

Defined in get-medial-points/double/get-medial-points.ts:78

Returns candidate ray parameter values t, bezier parameter values s and medial points for points q(t) and b(s) that satisfy the medial condition with respect to p and ps:

Let p be a fixed point in the plane. Let v be a direction vector defining the ray q(t) = p + t⋅v. Let ps be a bezier curve.

  • q(t) is equidistant from p and the nearest point on ps
  • that common distance is locally minimal among such candidates

In other words, this function returns candidate ray parameters for the sought medial point(s). Selecting physically valid solutions (if needed) is done by the caller or by a later stage of this routine.

Note!
Green circles are draggable!
0

Parameters:

NameTypeDescription
pnumber[]base point
vnumber[]ray direction from p
psnumber[][]bezier curve given as an array of control points, e.g. [[0,0],[1,1],[2,1]]