nearestOnCubic
import { nearestOnCubic } from 'pixi-silk/path';
function nearestOnCubic(c: Cubic, p: Vec): {
distance: number;
t: number;
x: number;
y: number;
};
The closest point of a cubic to p. It takes 33 samples and refines around the best one, so it
can pick the wrong part of a curve that passes almost equally close twice.
Parameters#
| Parameter | Type |
|---|---|
c | Cubic |
p | Vec |
Returns#
{
distance: number;
t: number;
x: number;
y: number;
}
| Name | Type | Defined in |
|---|---|---|
distance | number | path.ts:159 |
t | number | path.ts:159 |
x | number | path.ts:159 |
y | number | path.ts:159 |