Search Results for

    Show / Hide Table of Contents

    Class RayCrossingCounter

    Counts the number of segments crossed by a horizontal ray extending to the right from a given point, in an incremental fashion.

    This can be used to determine whether a point lies in a IPolygonal geometry.

    The class determines the situation where the point lies exactly on a segment.

    When being used for Point-In-Polygon determination, this case allows short-circuiting the evaluation.

    Inheritance
    object
    RayCrossingCounter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Algorithm
    Assembly: NetTopologySuite.dll
    Syntax
    public class RayCrossingCounter
    Remarks

    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

    • touch the ray
    • lie in in any ring which may contain the point

    The only exception is when the point-on-segment situation is detected, in which case no further processing is required. The implication of the above rule is that segments which can be a priori determined to not touch the ray (i.e. by a test of their bounding box or Y-extent) do not need to be counted. This allows for optimization by indexing.

    This implementation uses the extended-precision orientation test, to provide maximum robustness and consistency within other algorithms.

    Constructors

    | Edit this page View Source

    RayCrossingCounter(Coordinate)

    Creates an instance of this class

    Declaration
    public RayCrossingCounter(Coordinate p)
    Parameters
    Type Name Description
    Coordinate p

    A coordinate.

    Properties

    | Edit this page View Source

    Count

    Gets the count of crossings.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    IsOnSegment

    Reports whether the point lies exactly on one of the supplied segments.

    Declaration
    public bool IsOnSegment { get; }
    Property Value
    Type Description
    bool
    Remarks

    This method may be called at any time as segments are processed. If the result of this method is true, no further segments need be supplied, since the result will never change again.

    | Edit this page View Source

    IsPointInPolygon

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

    Declaration
    public bool IsPointInPolygon { get; }
    Property Value
    Type Description
    bool
    Remarks

    This property only determines the correct location if all relevant segments have been processed

    | Edit this page View Source

    Location

    Gets the Location of the point relative to the ring, polygon or multipolygon from which the processed segments were provided.

    Declaration
    public Location Location { get; }
    Property Value
    Type Description
    Location
    Remarks

    This property only determines the correct location if all relevant segments have been processed.

    Methods

    | Edit this page View Source

    CountSegment(Coordinate, Coordinate)

    Counts a segment

    Declaration
    public void CountSegment(Coordinate p1, Coordinate p2)
    Parameters
    Type Name Description
    Coordinate p1

    An endpoint of the segment

    Coordinate p2

    Another endpoint of the segment

    | Edit this page View Source

    LocatePointInRing(Coordinate, CoordinateSequence)

    Determines the Location of a point in a ring.

    Declaration
    public static Location LocatePointInRing(Coordinate p, CoordinateSequence ring)
    Parameters
    Type Name Description
    Coordinate p

    The point to test

    CoordinateSequence ring

    A coordinate sequence forming a ring

    Returns
    Type Description
    Location

    The location of the point in the ring

    | Edit this page View Source

    LocatePointInRing(Coordinate, Coordinate[])

    Determines the Location of a point in a ring. This method is an exemplar of how to use this class.

    Declaration
    public static Location LocatePointInRing(Coordinate p, Coordinate[] ring)
    Parameters
    Type Name Description
    Coordinate p

    The point to test

    Coordinate[] ring

    An array of Coordinates forming a ring

    Returns
    Type Description
    Location

    The location of the point in the ring

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX