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

segmentsCrossfunction

Whether two leaders cross. Touching at an end is not crossing.

Import it

import { segmentsCross } from "@johnmorrisdotca/chizu";

Definition

function segmentsCross(a: readonly [number, number], b: readonly [number, number], c: readonly [number, number], d: readonly [number, number]): boolean

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

boolean

Whether two leaders cross. Touching at an end is not crossing.

Examples

import { segmentsCross } from "@johnmorrisdotca/chizu";

console.log(segmentsCross([0, 0], [10, 10], [0, 10], [10, 0]), segmentsCross([0, 0], [10, 0], [0, 5], [10, 5]));
// true false
true false

What it prints (run when this page was built)

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