/** @packageDocumentation * @module Topology */ /** * `XYParitySearchContext` is an internal class for callers that can feed points (without extracting to array structures) * * Most will be via static methods which handle a specific data source. * * PolygonOps.classifyPointInPolygon(x,y,points: XAndY[]) * * HalfEdgeGraphSearch.pointInOrOnFaceXY(halfEdgeOnFace, x, y) * Use pattern: * * Caller must be able to walk around polygon producing x,y coordinates (possibly transformed from actual polygon). * * Caller announce edges to tryStartEdge until finding one acceptable to the search. * * Caller then passes additional points up to and including both x0,y0 and x1, y1 of the accepted start edge. * Call sequence is: * * `context = new XYParitySearchContext` * * `repeat { acquire edge (x0,y0) (x1,y1) } until context.tryStartEdge(x0,y0,x1,y1);` * * `for each (x,y) beginning AFTER x1,y1 and ending with (x1,y1) context.advance (x,y)` * * `return context.classifyCounts();` */ export declare class XYParitySearchContext { xTest: number; yTest: number; /** local x-coordinate of the start of the previous (or earlier) edge */ u0: number; /** local y-coordinate of the start of the previous (or earlier) edge */ v0: number; /** local x-coordinate of the end of the previous edge (and start of current edge) */ u1: number; /** local y-coordinate of the end of the previous edge (and start of current edge) */ v1: number; numLeftCrossing: number; numRightCrossing: number; numHit: number; /** * Create a new searcher for specified test point. * @param xTest x coordinate of test point. * @param yTest y coordinate of test point. */ constructor(xTest: number, yTest: number); /** Test if parity processing can begin with this edge. */ tryStartEdge(x0: number, y0: number, x1: number, y1: number): boolean; /** Update local coordinates: the current edge becomes the previous edge. */ private updateUV01; /** * Process the current edge ending at (x2,y2). * * Accumulate left/right parity of the test point wrt to the polygon. These counts track the number of polygon crossings * of the left and right horizontal rays emanating from the test point. After all edges are processed, if either count is * odd/even, the test point is inside/outside the polygon (see [[classifyCounts]]). * * Check whether the test point lies on the edge. * @returns whether caller should continue processing with the next edge. In particular, `false` if we have an exact hit. */ advance(x2: number, y2: number): boolean; /** * Return classification as ON, IN, or OUT according to hit and crossing counts. * * Any nonzero hit count is ON. * * Otherwise IN if left crossing count is odd. * @return 0 if ON, 1 if IN, -1 if OUT. */ classifyCounts(): number; } //# sourceMappingURL=XYParitySearchContext.d.ts.map