Reference · Framing, geometry and quiz tools
segmentsGapfunction
How close two leaders come, where they do not cross: the nearest any point of one gets to the other. Zero when they cross.
Import it
import { segmentsGap } from "@johnmorrisdotca/chizu";
Definition
function segmentsGap(a: readonly [number, number], b: readonly [number, number], c: readonly [number, number], d: readonly [number, number]): number
Parameters
| Name | Type | Description |
|---|---|---|
a | readonly [number, number] | The first point or segment endpoint, in native map units. |
b | readonly [number, number] | The second point or segment endpoint, in native map units. |
c | readonly [number, number] | The first endpoint of the other segment, in native map units. |
d | readonly [number, number] | The second endpoint of the other segment, in native map units. |
Returns
number
How close two leaders come, where they do not cross: the nearest any point of one gets to the other. Zero when they cross.
Examples
import { segmentsGap } from "@johnmorrisdotca/chizu";
console.log(segmentsGap([0, 0], [10, 0], [0, 5], [10, 5]));
// 55What it prints (run when this page was built)