import type { MultiFn2O } from "@thi.ng/defmulti" ; import { defmulti } from "@thi.ng/defmulti/defmulti" ; import type { IShape } from "@thi.ng/geom-api" ; import { classifyPointInCircle , classifyPointInTriangle2 , } from "@thi.ng/geom-isec/point" ; import { sign } from "@thi.ng/math/abs" ; import { EPS } from "@thi.ng/math/api" ; import type { ReadonlyVec } from "@thi.ng/vectors" ; import { dot } from "@thi.ng/vectors/dot" ; import type { Circle } from "./api/circle.js" ; import type { Plane } from "./api/plane.js" ; import type { Triangle } from "./api/triangle.js" ; import { __dispatch } from "./internal/dispatch.js" ; export const classifyPoint = defmulti < any , ReadonlyVec , number | undefined , number > ( __dispatch , { sphere : "circle" } , { circle : ( $ , p , eps = EPS ) => classifyPointInCircle ( p , $ . pos , $ . r , eps ) , plane : ( $ , p , eps ) => sign ( dot ( $ . normal , p ) - $ . w , eps ) , tri : ( { points } , p , eps = EPS ) => classifyPointInTriangle2 ( p , points [ 0 ] , points [ 1 ] , points [ 2 ] , eps ) , } ) ;