Search Results for

    Show / Hide Table of Contents

    Class Orientation

    Functions to compute the orientation of basic geometric structures including point triplets(triangles) and rings. Orientation is a fundamental property of planar geometries (and more generally geometry on two-dimensional manifolds).

    Determining triangle orientation is notoriously subject to numerical precision errors in the case of collinear or nearly collinear points. NTS uses extended-precision arithmetic to increase the robustness of the computation.
    Inheritance
    object
    Orientation
    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 static class Orientation

    Methods

    | Edit this page View Source

    Index(Coordinate, Coordinate, Coordinate)

    Returns the orientation index of the direction of the point q relative to a directed infinite line specified by p1->p2. The index indicates whether the point lies to the Left or Right of the line, or lies on it Collinear. The index also indicates the orientation of the triangle formed by the three points (CounterClockwise, Clockwise, or Straight )

    Declaration
    public static OrientationIndex Index(Coordinate p1, Coordinate p2, Coordinate q)
    Parameters
    Type Name Description
    Coordinate p1

    The origin point of the line vector

    Coordinate p2

    The final point of the line vector

    Coordinate q

    The point to compute the direction to

    Returns
    Type Description
    OrientationIndex

    The OrientationIndex of q in regard to the vector p1->p2

    ValueDescription
    Collinear, Straightq is collinear with p1->p2
    Clockwise, Rightq is clockwise (right) from p1->p2
    CounterClockwise, Leftq is counter-clockwise (left) from p1->p2
    | Edit this page View Source

    IsCCW(CoordinateSequence)

    Tests if a ring defined by a CoordinateSequence is oriented counter-clockwise.

    • The list of points is assumed to have the first and last points equal.
    • This handles coordinate lists which contain repeated points.
    • This handles rings which contain collapsed segments (in particular, along the top of the ring).
    This algorithm is guaranteed to work with valid rings. It also works with "mildly invalid" rings which contain collapsed(coincident) flat segments along the top of the ring. If the ring is "more" invalid (e.g.self-crosses or touches), the computed result may not be correct.
    Declaration
    public static bool IsCCW(CoordinateSequence ring)
    Parameters
    Type Name Description
    CoordinateSequence ring

    A CoordinateSequences forming a ring (with first and last point identical).

    Returns
    Type Description
    bool

    true if the ring is oriented counter-clockwise.

    | Edit this page View Source

    IsCCW(Coordinate[])

    Tests if a ring defined by an array of Coordinates is oriented counter-clockwise.

    • The list of points is assumed to have the first and last points equal.
    • This handles coordinate lists which contain repeated points.
    • This handles rings which contain collapsed segments (in particular, along the top of the ring).
    This algorithm is guaranteed to work with valid rings. It also works with "mildly invalid" rings which contain collapsed(coincident) flat segments along the top of the ring. If the ring is "more" invalid (e.g.self-crosses or touches), the computed result may not be correct.
    Declaration
    public static bool IsCCW(Coordinate[] ring)
    Parameters
    Type Name Description
    Coordinate[] ring

    An array of Coordinates forming a ring (with first and last point identical)

    Returns
    Type Description
    bool

    true if the ring is oriented counter-clockwise.

    | Edit this page View Source

    IsCCWArea(CoordinateSequence)

    Tests if a ring defined by a CoordinateSequence is oriented counter-clockwise, using the signed area of the ring.

    • The list of points is assumed to have the first and last points equal.
    • This handles coordinate lists which contain repeated points.
    • This handles rings which contain collapsed segments (in particular, along the top of the ring).
    • This handles rings which are invalid due to self-intersection
    This algorithm is guaranteed to work with valid rings. For invalid rings (containing self-intersections), the algorithm determines the orientation of the largest enclosed area (including overlaps). This provides a more useful result in some situations, such as buffering.

    However, this approach may be less accurate in the case of rings with almost zero area. (Note that the orientation of rings with zero area is essentially undefined, and hence non-deterministic.)
    Declaration
    public static bool IsCCWArea(CoordinateSequence ring)
    Parameters
    Type Name Description
    CoordinateSequence ring

    An array of Coordinates forming a ring (with first and last point identical)

    Returns
    Type Description
    bool

    true if the ring is oriented counter-clockwise.

    | Edit this page View Source

    IsCCWArea(Coordinate[])

    Tests if a ring defined by an array of Coordinates is oriented counter-clockwise, using the signed area of the ring.

    • The list of points is assumed to have the first and last points equal.
    • This handles coordinate lists which contain repeated points.
    • This handles rings which contain collapsed segments (in particular, along the top of the ring).
    • This handles rings which are invalid due to self-intersection
    This algorithm is guaranteed to work with valid rings. For invalid rings (containing self-intersections), the algorithm determines the orientation of the largest enclosed area (including overlaps). This provides a more useful result in some situations, such as buffering.

    However, this approach may be less accurate in the case of rings with almost zero area. (Note that the orientation of rings with zero area is essentially undefined, and hence non-deterministic.)
    Declaration
    public static bool IsCCWArea(Coordinate[] ring)
    Parameters
    Type Name Description
    Coordinate[] ring

    An array of Coordinates forming a ring (with first and last point identical)

    Returns
    Type Description
    bool

    true if the ring is oriented counter-clockwise.

    | Edit this page View Source

    ReOrient(OrientationIndex)

    Re-orients an orientation.

    Declaration
    public static OrientationIndex ReOrient(OrientationIndex orientation)
    Parameters
    Type Name Description
    OrientationIndex orientation

    The orientation

    Returns
    Type Description
    OrientationIndex
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX