public class RayCrossingCounter extends Object
Polygonal
geometry.
The class determines the situation where the point lies exactly on a segment.
When being used for PointInPolygon determination, this case allows shortcircuiting
the evaluation.
This class handles polygonal geometries with any number of shells and holes. The orientation of the shell and hole rings is unimportant. In order to compute a correct location for a given polygonal geometry, it is essential that all segments are counted which
This implementation uses the extendedprecision orientation test, to provide maximum robustness and consistency within other algorithms.
Constructor and Description 

RayCrossingCounter(Coordinate p) 
Modifier and Type  Method and Description 

void 
countSegment(Coordinate p1,
Coordinate p2)
Counts a segment

int 
getLocation()
Gets the
Location of the point relative to
the ring, polygon
or multipolygon from which the processed segments were provided. 
boolean 
isOnSegment()
Reports whether the point lies exactly on one of the supplied segments.

boolean 
isPointInPolygon()
Tests whether the point lies in or on
the ring, polygon
or multipolygon from which the processed segments were provided.

static int 
locatePointInRing(Coordinate p,
Coordinate[] ring)
Determines the
Location of a point in a ring. 
static int 
locatePointInRing(Coordinate p,
CoordinateSequence ring)
Determines the
Location of a point in a ring. 
public RayCrossingCounter(Coordinate p)
public static int locatePointInRing(Coordinate p, Coordinate[] ring)
Location
of a point in a ring.
This method is an exemplar of how to use this class.p
 the point to testring
 an array of Coordinates forming a ringpublic static int locatePointInRing(Coordinate p, CoordinateSequence ring)
Location
of a point in a ring.p
 the point to testring
 a coordinate sequence forming a ringpublic void countSegment(Coordinate p1, Coordinate p2)
p1
 an endpoint of the segmentp2
 another endpoint of the segmentpublic boolean isOnSegment()
public int getLocation()
Location
of the point relative to
the ring, polygon
or multipolygon from which the processed segments were provided.
This method only determines the correct location if all relevant segments must have been processed.
public boolean isPointInPolygon()
This method only determines the correct location if all relevant segments must have been processed.
Copyright © 2020. All rights reserved.