Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

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

NameTypeDescription
areadonly [number, number]

The first point or segment endpoint, in native map units.

breadonly [number, number]

The second point or segment endpoint, in native map units.

creadonly [number, number]

The first endpoint of the other segment, in native map units.

dreadonly [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]));
// 5
5

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.