import type { MultiFn1O } from "@thi.ng/defmulti" ; import { defmulti } from "@thi.ng/defmulti/defmulti" ; import type { IShape , SamplingOpts } from "@thi.ng/geom-api" ; import type { VecPair } from "@thi.ng/vectors" ; import type { AABB } from "./api/aabb.js" ; import type { Polygon } from "./api/polygon.js" ; import type { Polyline } from "./api/polyline.js" ; import type { Rect } from "./api/rect.js" ; import { __dispatch } from "./internal/dispatch.js" ; import { __edges } from "./internal/edges.js" ; import { vertices } from "./vertices.js" ; export const edges = defmulti < any , number | Partial < SamplingOpts > | undefined , Iterable < VecPair > > ( __dispatch , { line : "polyline" , quad : "poly" , tri : "poly" , } , { aabb : ( $ ) => { const [ a , b , c , d , e , f , g , h ] = vertices ( $ ) ; return [ [ a , b ] , [ b , c ] , [ c , d ] , [ d , a ] , [ e , f ] , [ f , g ] , [ g , h ] , [ h , e ] , [ a , e ] , [ b , f ] , [ c , g ] , [ d , h ] , ] ; } , poly : ( $ ) => __edges ( $ . points , true ) , polyline : ( $ ) => __edges ( $ . points ) , rect : ( $ ) => __edges ( vertices ( $ ) , true ) , } ) ;