geom_lib/geomat3d.c:970 int CGPolygonRayInter(IPPolygonStruct *Pl, PointType PtRay, int RayAxes)
Algorithm:
1. 1.1. Set NumOfIntersection = 0;
1.2. Find vertex V not on Ray level and set AlgState to its level
(below or above the ray level). If none goto 3;
1.3. Mark VStart = V;
2. Do
2.1. While State(V) == AlgState do
2.1.1. V = V -> Pnext;
2.1.2. If V == VStart goto 3;
2.2. IntersectionMinX = INFINITY;
2.3. While State(V) == ON_RAY do
2.3.1. IntersectionMin = MIN(IntersectionMin, V -> Coord[Axes]);
2.3.2. V = V -> Pnext;
2.4. If State(V) != AlgState do
2.4.1. Find the intersection point between polygon edge
Vlast, V and the Ray and update IntersectionMin if
lower than it.
2.4.2. If IntersectionMin is greater than Pt[Axes] increase
the NumOfIntersection counter by 1.
2.5. AlgState = State(V);
2.6. goto 2.2.
3. Return NumOfIntersection;
Pl: To compute "Jordan Theorem" for the given ray.
PtRay: Origin of ray.
RayAxes: Direction of ray. 0 for X, 1 for Y, etc.