Show / Hide Table of Contents

    Class CGAlgorithms

    Specifies and implements various fundamental Computational Geometric algorithms. The algorithms supplied in this class are robust for double-precision floating point.

    Inheritance
    System.Object
    CGAlgorithms
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Mapsui.Geometries.Utilities
    Assembly: Mapsui.Geometries.dll
    Syntax
    public static class CGAlgorithms

    Fields

    | Improve this Doc View Source

    Clockwise

    A value that indicates an orientation of clockwise, or a right turn.

    Declaration
    public const int Clockwise = -1
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Collinear

    A value that indicates an orientation of collinear, or no turn (straight).

    Declaration
    public const int Collinear = 0
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    CounterClockwise

    A value that indicates an orientation of counterclockwise, or a left turn.

    Declaration
    public const int CounterClockwise = 1
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Left

    A value that indicates an orientation of counterclockwise, or a left turn.

    Declaration
    public const int Left = 1
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Right

    A value that indicates an orientation of clockwise, or a right turn.

    Declaration
    public const int Right = -1
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Straight

    A value that indicates an orientation of collinear, or no turn (straight).

    Declaration
    public const int Straight = 0
    Field Value
    Type Description
    System.Int32

    Methods

    | Improve this Doc View Source

    ClosestPoint(Point, Point, Point)

    Computes the closest point on this line segment to another point.

    Declaration
    public static Point ClosestPoint(Point p, Point lineSegFrom, Point lineSegTo)
    Parameters
    Type Name Description
    Point p
    Point lineSegFrom
    Point lineSegTo
    Returns
    Type Description
    Point

    A Coordinate which is the closest point on the line segment to the point p.

    | Improve this Doc View Source

    DistanceLineLine(Point, Point, Point, Point)

    Computes the distance from a line segment AB to a line segment CD. Note: NON-ROBUST!

    Declaration
    public static double DistanceLineLine(Point a, Point b, Point c, Point d)
    Parameters
    Type Name Description
    Point a

    A point of one line.

    Point b

    The second point of the line (must be different to A).

    Point c

    One point of the line.

    Point d

    Another point of the line (must be different to A).

    Returns
    Type Description
    System.Double

    The distance from line segment AB to line segment CD.

    | Improve this Doc View Source

    DistancePointLine(Point, Point, Point)

    Computes the distance from a point p to a line segment AB. Note: NON-ROBUST!

    Declaration
    public static double DistancePointLine(Point p, Point a, Point b)
    Parameters
    Type Name Description
    Point p

    The point to compute the distance for.

    Point a

    One point of the line.

    Point b

    Another point of the line (must be different to A).

    Returns
    Type Description
    System.Double

    The distance from p to line segment AB.

    | Improve this Doc View Source

    DistancePointLinePerpendicular(Point, Point, Point)

    Computes the perpendicular distance from a point p to the (infinite) line containing the points AB

    Declaration
    public static double DistancePointLinePerpendicular(Point p, Point a, Point b)
    Parameters
    Type Name Description
    Point p

    The point to compute the distance for.

    Point a

    One point of the line.

    Point b

    Another point of the line (must be different to A).

    Returns
    Type Description
    System.Double

    The perpendicular distance from p to line AB.

    | Improve this Doc View Source

    Length(IList<Point>)

    Computes the length of a linestring specified by a sequence of points.

    Declaration
    public static double Length(IList<Point> pts)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Point> pts

    The points specifying the linestring.

    Returns
    Type Description
    System.Double

    The length of the linestring.

    | Improve this Doc View Source

    Project(Point, Point, Point)

    Compute the projection of a point onto the line determined by this line segment. Note that the projected point may lie outside the line segment. If this is the case, the projection factor will lie outside the range [0.0, 1.0].

    Declaration
    public static Point Project(Point p, Point lineSegFrom, Point lineSegTo)
    Parameters
    Type Name Description
    Point p
    Point lineSegFrom
    Point lineSegTo
    Returns
    Type Description
    Point
    | Improve this Doc View Source

    ProjectionFactor(Point, Point, Point)

    Compute the projection factor for the projection of the point p onto this LineSegment. The projection factor is the constant k by which the vector for this segment must be multiplied to equal the vector for the projection of p.

    Declaration
    public static double ProjectionFactor(Point p, Point lineSegFrom, Point lineSegTo)
    Parameters
    Type Name Description
    Point p
    Point lineSegFrom
    Point lineSegTo
    Returns
    Type Description
    System.Double
    | Improve this Doc View Source

    SignedArea(Point[])

    Returns the signed area for a ring. The area is positive ifthe ring is oriented CW.

    Declaration
    public static double SignedArea(Point[] ring)
    Parameters
    Type Name Description
    Point[] ring
    Returns
    Type Description
    System.Double
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX