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 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(x: number, y: number): boolean |
Return true if parity accumulation proceeded normally. |
|
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 x,y is a safe first coordinate to start the search. |
|
Properties
Name |
Type |
Description |
|
numHit |
number |
|
|
numLeftCrossing |
number |
|
|
numRightCrossing |
number |
|
|
u0 |
number |
|
|
u1 |
number |
|
|
v0 |
number |
|
|
v1 |
number |
|
|
xTest |
number |
|
|
yTest |
number |
|
|
Defined in
Last Updated:
30 November, 2023