XYParitySearchContext Class
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();
Methods
Name | Description | |
---|---|---|
constructor(xTest: number, yTest: number): XYParitySearchContext | Create a new searcher for specified test point. | |
advance(x2: number, y2: number): boolean | Process the current edge ending at (x2,y2). | |
classifyCounts(): undefined | number | Return classification as ON, IN, or OUT according to hit and crossing counts. | |
tryStartEdge(x0: number, y0: number, x1: number, y1: number): boolean | Test if parity processing can begin with this edge. |
Properties
Defined in
Last Updated: 17 December, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.