get-coeffs-bez-bez
function getCoeffsBezBez(ps1: number[][], ps2: number[][]): object
Defined in intersection/bezier-bezier-intersection/get-coefficients/get-coeffs-bez-bez.ts:55
Returns an object with properties containing (1) the coefficients (in double-double
precision) of a polynomial in 1 variable whose roots are the parameter values
(of the second curve) of the intersection points of two given order 1, 2 or 3 bezier curves (i.e. lines,
quadratic and cubic bezier curves), (2) the coefficientwise error bound of the polyomial,
and (3) a function that returns the exact polynomial coefficients as
Shewchuk expansions.
The returned polynomial coefficients are given densely as an array of
double-double precision floating point numbers from highest to lowest power,
e.g. [[0,5],[0,-3],[0,0]]
represents the polynomial 5x^2 - 3x
.
- if there is an infinite number of intersections
undefined
is returned - intermediate calculations are done in double-double precision with fallback to infinite precision (bar underflow / overflow)
The below example illustrates the fact that if 2 bezier curves are algebraically identical then the resulting intersection polynomial will be identically zero...
Note!
...but if a single coordinate is perturbed slightly (2**-40 in the case below) then the resulting polynomial will not be zero anymore.
The example below is just some arbitrary cubic bezier curves.
This example illustrates Bezout's Theorem: a cubic-cubic intersection implies 3x3 = 9 intersections at most.
Parameters:
Name | Type | Description |
---|---|---|
ps1 | number[][] | |
ps2 | number[][] |
Returns: object
Name | Type |
---|---|
coeffs | number[][] |
errBound | number[] |
getPExact | () => number[][] |