Navigation · function

contourSelfIntersects

Whether any two non-adjacent segments of a closed loop cross.

Explained in Navigation.

function contourSelfIntersects(points: Int32Array): boolean
import { contourSelfIntersects } from '@driftengine/nav';

Parameters

ParameterTypeDescription
pointsInt32Array

In depth

Adjacent segments share an endpoint by construction and are skipped; everything else is a proper crossing test, so a loop that merely touches itself at a vertex is not reported — that is a pinch rather than a crossing, and a polygon built from it is still walkable.